From 36a86f52176e317638c02deb17156cd5446c68b8 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Tue, 11 Oct 2022 00:32:17 +0200 Subject: [PATCH] mac-virtualcam: Fix random crashes in applications loading VirtualCam Without invalidating the mach port used for sharing the IOSurface between OBS and the application displaying the virtual camera output, IOKit seems to run into the issue of receiving "shared" mach ports, possibly because of port exhaustion. IOKit requires a "new" port however and crashes upon that error otherwise. Co-authored-by: Steven Michaud --- plugins/mac-virtualcam/src/dal-plugin/OBSDALMachClient.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mac-virtualcam/src/dal-plugin/OBSDALMachClient.mm b/plugins/mac-virtualcam/src/dal-plugin/OBSDALMachClient.mm index c6126398c..c6c0cde2a 100644 --- a/plugins/mac-virtualcam/src/dal-plugin/OBSDALMachClient.mm +++ b/plugins/mac-virtualcam/src/dal-plugin/OBSDALMachClient.mm @@ -114,6 +114,7 @@ IOSurfaceRef surface = IOSurfaceLookupFromMachPort( [framePort machPort]); + [framePort invalidate]; mach_port_deallocate(mach_task_self(), [framePort machPort]);