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
+1
View File
@@ -46,6 +46,7 @@
- Bugfix: Fixed a crash that could occur an eventsub connection's keepalive timer would run after the connection was dead, causing the keepalive timer to use-itself-after-free. (#6204) - Bugfix: Fixed a crash that could occur an eventsub connection's keepalive timer would run after the connection was dead, causing the keepalive timer to use-itself-after-free. (#6204)
- Bugfix: Fixed a crash that could occur when an image started loading mid app shutdown. (#6213) - Bugfix: Fixed a crash that could occur when an image started loading mid app shutdown. (#6213)
- Bugfix: Fixed a crash that could occur on exit if a ping played less than 30 seconds prior. (#6332) - Bugfix: Fixed a crash that could occur on exit if a ping played less than 30 seconds prior. (#6332)
- Bugfix: Fixed a crash that could occur on exit on newer versions of Qt. (#6368)
- Bugfix: Fixed notebook buttons (settings, account switcher, streamer mode) not performing a relayout when their visibility changed, causing a gap until resize. Linux / macOS only. (#6328) - Bugfix: Fixed notebook buttons (settings, account switcher, streamer mode) not performing a relayout when their visibility changed, causing a gap until resize. Linux / macOS only. (#6328)
- Bugfix: Fixed some minor typos. (#6196) - Bugfix: Fixed some minor typos. (#6196)
- Bugfix: Fixed inconsistent spaces in messages when using fractional scaling. (#6231, #6254) - Bugfix: Fixed inconsistent spaces in messages when using fractional scaling. (#6231, #6254)
+2
View File
@@ -607,6 +607,8 @@ void Application::aboutToQuit()
this->hotkeys->save(); this->hotkeys->save();
this->windows->save(); this->windows->save();
this->windows->closeAll();
} }
void Application::stop() void Application::stop()
+1 -1
View File
@@ -350,7 +350,7 @@ Window &WindowManager::createWindow(WindowType type, bool show, QWidget *parent)
{ {
window->setAttribute(Qt::WA_DeleteOnClose); window->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(window, &QWidget::destroyed, [this, window] { QObject::connect(window, &QWidget::destroyed, this, [this, window] {
for (auto it = this->windows_.begin(); it != this->windows_.end(); for (auto it = this->windows_.begin(); it != this->windows_.end();
it++) it++)
{ {
+4 -1
View File
@@ -5,6 +5,7 @@
#include "widgets/splits/SplitContainer.hpp" #include "widgets/splits/SplitContainer.hpp"
#include <pajlada/settings/settinglistener.hpp> #include <pajlada/settings/settinglistener.hpp>
#include <QObject>
#include <QPoint> #include <QPoint>
#include <QTimer> #include <QTimer>
@@ -36,8 +37,10 @@ enum class WindowType;
enum class SettingsDialogPreference; enum class SettingsDialogPreference;
class FramelessEmbedWindow; class FramelessEmbedWindow;
class WindowManager final class WindowManager final : public QObject
{ {
Q_OBJECT
Theme &themes; Theme &themes;
const Args &appArgs; const Args &appArgs;
+12 -3
View File
@@ -153,10 +153,19 @@ bool Window::event(QEvent *event)
void Window::closeEvent(QCloseEvent *) 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) if (this->type_ == WindowType::Main)
{ {
getApp()->getWindows()->save(); app->getWindows()->save();
getApp()->getWindows()->closeAll(); app->getWindows()->closeAll();
} }
else else
{ {
@@ -167,7 +176,7 @@ void Window::closeEvent(QCloseEvent *)
// Ensure selectedWindow_ is never an invalid pointer. // Ensure selectedWindow_ is never an invalid pointer.
// WindowManager will return the main window if no window is pointed to by // WindowManager will return the main window if no window is pointed to by
// `selectedWindow_`. // `selectedWindow_`.
getApp()->getWindows()->selectedWindow_ = nullptr; app->getWindows()->selectedWindow_ = nullptr;
this->closed.invoke(); this->closed.invoke();