fix: don't detach threads (#6333)
Previously, we would detach threads that did not exit in a reasonable time, meaning they'd continue running and potentially accessing data that had been freed, causing us to crash. With this change, we _dont_ detach the thread, and let the thread destructor do as it pleases (which will be terminating). Neither solution is clean - old solution would sometimes work, but this should give us a better indicator of where we're doing things wrong.
This commit is contained in:
@@ -235,7 +235,6 @@ MiniaudioBackend::~MiniaudioBackend()
|
||||
|
||||
qCWarning(chatterinoSound)
|
||||
<< "Audio thread did not stop within 1 second";
|
||||
this->audioThread->detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,9 +175,7 @@ public:
|
||||
}
|
||||
|
||||
qCWarning(chatterinoLiveupdates)
|
||||
<< "Thread didn't finish after stopping, discard it";
|
||||
// detach the thread so the destructor doesn't attempt any joining
|
||||
this->mainThread_->detach();
|
||||
<< "Thread didn't finish after stopping";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -143,10 +143,7 @@ void PubSub::stop()
|
||||
return;
|
||||
}
|
||||
|
||||
qCWarning(chatterinoLiveupdates)
|
||||
<< "Thread didn't finish after stopping, discard it";
|
||||
// detach the thread so the destructor doesn't attempt any joining
|
||||
this->thread->detach();
|
||||
qCWarning(chatterinoLiveupdates) << "Thread didn't finish after stopping";
|
||||
}
|
||||
|
||||
void PubSub::listenToChannelPointRewards(const QString &channelID)
|
||||
|
||||
Reference in New Issue
Block a user