8378727: [macOS] Missing dispatch_release for semaphores in CDesktopPeer

Reviewed-by: honkar, kizune, azvegint, dmarkov
This commit is contained in:
Sergey Bylokhov 2026-03-18 03:36:00 +00:00
parent abb9c33ced
commit d52e5bd035

View File

@ -70,6 +70,7 @@ JNI_COCOA_ENTER(env);
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC)); // 1 second timeout
// Asynchronous call to openURL
dispatch_retain(semaphore);
[[NSWorkspace sharedWorkspace] openURLs:urls
withApplicationAtURL:appURI
configuration:configuration
@ -78,9 +79,11 @@ JNI_COCOA_ENTER(env);
status = (OSStatus) error.code;
}
dispatch_semaphore_signal(semaphore);
dispatch_release(semaphore);
}];
dispatch_semaphore_wait(semaphore, timeout);
dispatch_release(semaphore);
JNI_COCOA_EXIT(env);
return status;
@ -146,6 +149,7 @@ JNI_COCOA_ENTER(env);
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC)); // 1 second timeout
// Asynchronous call - openURLs:withApplicationAtURL
dispatch_retain(semaphore);
[[NSWorkspace sharedWorkspace] openURLs:urls
withApplicationAtURL:appURI
configuration:configuration
@ -154,9 +158,11 @@ JNI_COCOA_ENTER(env);
status = (OSStatus) error.code;
}
dispatch_semaphore_signal(semaphore);
dispatch_release(semaphore);
}];
dispatch_semaphore_wait(semaphore, timeout);
dispatch_release(semaphore);
[urlToOpen release];
JNI_COCOA_EXIT(env);