Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanly exit Chatterino instead of force exiting #4993

Closed
wants to merge 14 commits into from
Closed
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
- Dev: Added Tests for Windows and MacOS in CI. (#4970)
- Dev: Refactored the Image Uploader feature. (#4971)
- Dev: Fixed deadlock and use-after-free in tests. (#4981)
- Dev: Cleanly exit Chatterino instead of force exiting. (#4993)

## 2.4.6

Expand Down
6 changes: 4 additions & 2 deletions src/RunGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <QtConcurrent>

#include <csignal>
#include <thread>
#include <tuple>

#ifdef USEWINSDK
Expand Down Expand Up @@ -245,6 +246,7 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
});

auto thread = std::thread([dir = paths.miscDirectory] {
#ifdef Q_OS_WIN32
{
auto path = combinePath(dir, "Update.exe");
if (QFile::exists(path))
Expand All @@ -259,6 +261,7 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
QFile::remove(path);
}
}
#endif
});

// Clear the cache 1 minute after start.
Expand Down Expand Up @@ -308,13 +311,12 @@ void runGui(QApplication &a, Paths &paths, Settings &settings)
pajlada::Settings::SettingManager::gSave();
}

thread.join();
Mm2PL marked this conversation as resolved.
Show resolved Hide resolved
chatterino::NetworkManager::deinit();

#ifdef USEWINSDK
// flushing windows clipboard to keep copied messages
flushClipboard();
#endif

_exit(0);
}
} // namespace chatterino
Loading