0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Add initialization to ensure compat between pthread and NSThread

Ensures that Cocoa knows that we intend to use multiple threads, per
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/10000057i-CH15-SW21
This commit is contained in:
PatTheMav 2022-07-21 18:35:44 +02:00 committed by Patrick Heyer
parent eea2fd2f3f
commit c1740e3636
3 changed files with 11 additions and 0 deletions

View File

@ -2070,6 +2070,7 @@ static int run_program(fstream &logFile, int argc, char *argv[])
#if __APPLE__
InstallNSApplicationSubclass();
InstallNSThreadLocks();
if (!isInBundle()) {
blog(LOG_ERROR,

View File

@ -278,6 +278,15 @@ void TaskbarOverlaySetStatus(TaskbarOverlayStatus status)
}
@end
void InstallNSThreadLocks()
{
[[NSThread new] start];
if ([NSThread isMultiThreaded] != 1) {
abort();
}
}
void InstallNSApplicationSubclass()
{
[OBSApplication sharedApplication];

View File

@ -84,5 +84,6 @@ void EnableOSXVSync(bool enable);
void EnableOSXDockIcon(bool enable);
bool isInBundle();
void InstallNSApplicationSubclass();
void InstallNSThreadLocks();
void disableColorSpaceConversion(QWidget *window);
#endif