mac-virtualcam: Fix port leakage in Mach server
This change fixes an issue in the Mach server exposed by the macOS virtual camera for OBS, where it would not invalidate ports that were disconnected by the remote application, causing sporadic crashes. These crashes can be reproduced in the previous builds by opening the virtual camera in a remote application and closing the application (without stopping the virtual camera).
This commit is contained in:
parent
db733032e0
commit
40cb92a7a5
@ -101,19 +101,24 @@
|
||||
receivePort:nil
|
||||
components:components];
|
||||
message.msgid = msgId;
|
||||
if (![message
|
||||
if (![port isValid] ||
|
||||
![message
|
||||
sendBeforeDate:
|
||||
[NSDate dateWithTimeIntervalSinceNow:
|
||||
1.0]]) {
|
||||
blog(LOG_DEBUG,
|
||||
"failed to send message to %d, removing it from the clients!",
|
||||
((NSMachPort *)port).machPort);
|
||||
|
||||
[port invalidate];
|
||||
[removedPorts addObject:port];
|
||||
}
|
||||
} @catch (NSException *exception) {
|
||||
blog(LOG_DEBUG,
|
||||
"failed to send message (exception) to %d, removing it from the clients!",
|
||||
((NSMachPort *)port).machPort);
|
||||
|
||||
[port invalidate];
|
||||
[removedPorts addObject:port];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user