diff --git a/CHANGELOG.md b/CHANGELOG.md index 0edf1cb3..90c44fa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ - Bugfix: Fixed color input thinking blue is also red. (#5982) - Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011) - Bugfix: Fixed a thick border on Windows 11. (#5836) +- Bugfix: Fixed some windows not immediately closing. (#6054) - Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947) - Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048) - Dev: Remove unneeded platform specifier for toasts. (#5914) diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index ca8daf09..e07e6792 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -34,17 +34,36 @@ #include #include -namespace chatterino { namespace { - std::optional &shouldMoveOutOfBoundsWindow() +std::optional &shouldMoveOutOfBoundsWindow() +{ + static std::optional x; + return x; +} + +void closeWindowsRecursive(QWidget *window) +{ + if (window->isWindow() && window->isVisible()) { - static std::optional x; - return x; + window->close(); } + for (auto *child : window->children()) + { + if (child->isWidgetType()) + { + // We check if it's a widget above + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) + closeWindowsRecursive(static_cast(child)); + } + } +} + } // namespace +namespace chatterino { + const QString WindowManager::WINDOW_LAYOUT_FILENAME( QStringLiteral("window-layout.json")); @@ -782,7 +801,7 @@ void WindowManager::closeAll() for (Window *window : windows_) { - window->close(); + closeWindowsRecursive(window); } }