fix: better handle Windows shutting down in newer Qt versions (#6368)

This commit is contained in:
pajlada
2025-08-09 11:43:32 +02:00
committed by GitHub
parent f21f1b8781
commit f7042dc542
5 changed files with 20 additions and 5 deletions
+12 -3
View File
@@ -153,10 +153,19 @@ bool Window::event(QEvent *event)
void Window::closeEvent(QCloseEvent *)
{
if (isAppAboutToQuit())
{
qCWarning(chatterinoWidget)
<< "Window closeEvent ran when Application is already dead";
return;
}
auto *app = getApp();
if (this->type_ == WindowType::Main)
{
getApp()->getWindows()->save();
getApp()->getWindows()->closeAll();
app->getWindows()->save();
app->getWindows()->closeAll();
}
else
{
@@ -167,7 +176,7 @@ void Window::closeEvent(QCloseEvent *)
// Ensure selectedWindow_ is never an invalid pointer.
// WindowManager will return the main window if no window is pointed to by
// `selectedWindow_`.
getApp()->getWindows()->selectedWindow_ = nullptr;
app->getWindows()->selectedWindow_ = nullptr;
this->closed.invoke();