mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Destroy the window manager before TwitchIrcServer
TwitchIrcServer contains the channels, and they now live longer than the windows themselves. I made it so the dtor of WindowManager *actually* deletes the windows now - i.e. them and everything in them are destroyed.
This commit is contained in:
parent
51e5b6690d
commit
fbf13c7a9e
3 changed files with 12 additions and 3 deletions
|
@ -109,6 +109,7 @@ Application::Application(Settings &_settings, Paths &_paths)
|
||||||
, emotes(&this->emplace<Emotes>())
|
, emotes(&this->emplace<Emotes>())
|
||||||
, accounts(&this->emplace<AccountController>())
|
, accounts(&this->emplace<AccountController>())
|
||||||
, hotkeys(&this->emplace<HotkeyController>())
|
, hotkeys(&this->emplace<HotkeyController>())
|
||||||
|
, twitch(&this->emplace<TwitchIrcServer>())
|
||||||
, windows(&this->emplace<WindowManager>())
|
, windows(&this->emplace<WindowManager>())
|
||||||
, toasts(&this->emplace<Toasts>())
|
, toasts(&this->emplace<Toasts>())
|
||||||
, imageUploader(&this->emplace<ImageUploader>())
|
, imageUploader(&this->emplace<ImageUploader>())
|
||||||
|
@ -117,7 +118,6 @@ Application::Application(Settings &_settings, Paths &_paths)
|
||||||
, commands(&this->emplace<CommandController>())
|
, commands(&this->emplace<CommandController>())
|
||||||
, notifications(&this->emplace<NotificationController>())
|
, notifications(&this->emplace<NotificationController>())
|
||||||
, highlights(&this->emplace<HighlightController>())
|
, highlights(&this->emplace<HighlightController>())
|
||||||
, twitch(&this->emplace<TwitchIrcServer>())
|
|
||||||
, chatterinoBadges(&this->emplace<ChatterinoBadges>())
|
, chatterinoBadges(&this->emplace<ChatterinoBadges>())
|
||||||
, ffzBadges(&this->emplace<FfzBadges>())
|
, ffzBadges(&this->emplace<FfzBadges>())
|
||||||
, seventvBadges(&this->emplace<SeventvBadges>())
|
, seventvBadges(&this->emplace<SeventvBadges>())
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
Emotes *const emotes{};
|
Emotes *const emotes{};
|
||||||
AccountController *const accounts{};
|
AccountController *const accounts{};
|
||||||
HotkeyController *const hotkeys{};
|
HotkeyController *const hotkeys{};
|
||||||
|
TwitchIrcServer *const twitch{};
|
||||||
WindowManager *const windows{};
|
WindowManager *const windows{};
|
||||||
Toasts *const toasts{};
|
Toasts *const toasts{};
|
||||||
ImageUploader *const imageUploader{};
|
ImageUploader *const imageUploader{};
|
||||||
|
@ -106,7 +107,6 @@ public:
|
||||||
CommandController *const commands{};
|
CommandController *const commands{};
|
||||||
NotificationController *const notifications{};
|
NotificationController *const notifications{};
|
||||||
HighlightController *const highlights{};
|
HighlightController *const highlights{};
|
||||||
TwitchIrcServer *const twitch{};
|
|
||||||
ChatterinoBadges *const chatterinoBadges{};
|
ChatterinoBadges *const chatterinoBadges{};
|
||||||
FfzBadges *const ffzBadges{};
|
FfzBadges *const ffzBadges{};
|
||||||
SeventvBadges *const seventvBadges{};
|
SeventvBadges *const seventvBadges{};
|
||||||
|
|
|
@ -127,7 +127,16 @@ WindowManager::WindowManager()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowManager::~WindowManager() = default;
|
WindowManager::~WindowManager()
|
||||||
|
{
|
||||||
|
for (const auto &window : this->windows_)
|
||||||
|
{
|
||||||
|
// We would prefer to use window->deleteLater() here, but the timings are too tight
|
||||||
|
// Channel's completion model gets destroyed before the deleteLater call actually deletes the
|
||||||
|
// UI objects that rely on the completion model
|
||||||
|
delete window;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MessageElementFlags WindowManager::getWordFlags()
|
MessageElementFlags WindowManager::getWordFlags()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue