Skip to content

Commit a53ebbd

Browse files
Retain command buffer in Metal GRMtlBackendContext
AbandonContext appears to destroy the command buffer, causing the finalizer to crash from a double free. Fixes: mono#3178
1 parent fa7572b commit a53ebbd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

binding/SkiaSharp/GRContext.cs

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public static GRContext CreateMetal (GRMtlBackendContext backendContext, GRConte
9191
var device = backendContext.DeviceHandle;
9292
var queue = backendContext.QueueHandle;
9393

94+
#if __IOS__ || __MACOS__ || __TVOS__
95+
using Foundation.NSObject queueObject = Foundation.NSObject.FromObject(backendContext.Queue);
96+
queueObject.DangerousRetain ();
97+
#endif
98+
9499
if (options == null) {
95100
return GetObject (SkiaApi.gr_direct_context_make_metal ((void*)device, (void*)queue));
96101
} else {

0 commit comments

Comments
 (0)