Skip to content

Commit 51857e1

Browse files
committed
Fixed issue where obs64 would hang (mac-only)
1 parent f713a5d commit 51857e1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

obs-studio-server/source/util-osx-impl.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
return;
4444

4545
while (true) {
46+
if (!appRunning) {
47+
break;
48+
}
4649
int ret = ::read(file_descriptor, buffer.data(), count);
4750
if (ret > 0) {
4851
bool appCrashed = *reinterpret_cast<bool *>(buffer.data());
@@ -107,10 +110,10 @@ @implementation UtilImplObj
107110
data2:0];
108111
[NSApp postEvent:event atStart:TRUE];
109112

113+
appRunning = false;
110114
if (worker->joinable())
111115
worker->join();
112116

113-
appRunning = false;
114117
});
115118
}
116119

obs-studio-server/source/util-osx-int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class UtilObjCInt {
4141

4242
private:
4343
void *self;
44-
bool appRunning;
44+
std::atomic<bool> appRunning;
4545
std::thread *worker;
4646
};
4747

0 commit comments

Comments
 (0)