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:
parent
eea2fd2f3f
commit
c1740e3636
@ -2070,6 +2070,7 @@ static int run_program(fstream &logFile, int argc, char *argv[])
|
||||
|
||||
#if __APPLE__
|
||||
InstallNSApplicationSubclass();
|
||||
InstallNSThreadLocks();
|
||||
|
||||
if (!isInBundle()) {
|
||||
blog(LOG_ERROR,
|
||||
|
@ -278,6 +278,15 @@ void TaskbarOverlaySetStatus(TaskbarOverlayStatus status)
|
||||
}
|
||||
@end
|
||||
|
||||
void InstallNSThreadLocks()
|
||||
{
|
||||
[[NSThread new] start];
|
||||
|
||||
if ([NSThread isMultiThreaded] != 1) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void InstallNSApplicationSubclass()
|
||||
{
|
||||
[OBSApplication sharedApplication];
|
||||
|
@ -84,5 +84,6 @@ void EnableOSXVSync(bool enable);
|
||||
void EnableOSXDockIcon(bool enable);
|
||||
bool isInBundle();
|
||||
void InstallNSApplicationSubclass();
|
||||
void InstallNSThreadLocks();
|
||||
void disableColorSpaceConversion(QWidget *window);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user