fix: close known windows on exit (#6054)

This commit is contained in:
nerix
2025-03-09 18:55:55 +01:00
committed by GitHub
parent 037196ec3b
commit 8fefcee847
2 changed files with 25 additions and 5 deletions
+1
View File
@@ -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)
+24 -5
View File
@@ -34,17 +34,36 @@
#include <chrono>
#include <optional>
namespace chatterino {
namespace {
std::optional<bool> &shouldMoveOutOfBoundsWindow()
std::optional<bool> &shouldMoveOutOfBoundsWindow()
{
static std::optional<bool> x;
return x;
}
void closeWindowsRecursive(QWidget *window)
{
if (window->isWindow() && window->isVisible())
{
static std::optional<bool> 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<QWidget *>(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);
}
}