fix: cleanly exit on shutdown (#5537)
Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl> Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
@@ -136,6 +136,21 @@ NativeMessagingServer::NativeMessagingServer()
|
||||
{
|
||||
}
|
||||
|
||||
NativeMessagingServer::~NativeMessagingServer()
|
||||
{
|
||||
if (!ipc::IpcQueue::remove("chatterino_gui"))
|
||||
{
|
||||
qCWarning(chatterinoNativeMessage) << "Failed to remove message queue";
|
||||
}
|
||||
this->thread.requestInterruption();
|
||||
this->thread.quit();
|
||||
// Most likely, the receiver thread will still wait for a message
|
||||
if (!this->thread.wait(250))
|
||||
{
|
||||
this->thread.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
void NativeMessagingServer::start()
|
||||
{
|
||||
this->thread.start();
|
||||
@@ -161,7 +176,7 @@ void NativeMessagingServer::ReceiverThread::run()
|
||||
return;
|
||||
}
|
||||
|
||||
while (true)
|
||||
while (!this->isInterruptionRequested())
|
||||
{
|
||||
auto buf = messageQueue->receive();
|
||||
if (buf.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user