From 029818ba44703c5151f8d916284e307b05d08fa9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Nov 2013 00:09:32 +0300 Subject: Add configure option --enable-checks for check some calls (disabled by default) Also add configuration listeners removing in objects. --- src/gui/gui.cpp | 5 +++++ src/gui/theme.cpp | 1 + src/gui/viewport.cpp | 1 + src/gui/widgets/avatarlistbox.cpp | 1 + src/gui/widgets/tabs/guildchattab.cpp | 1 + src/gui/windowmenu.cpp | 1 + src/gui/windows/botcheckerwindow.cpp | 1 + src/gui/windows/chatwindow.cpp | 1 + src/gui/windows/minimap.cpp | 1 + src/gui/windows/npcdialog.cpp | 1 + src/gui/windows/whoisonline.cpp | 1 + 11 files changed, 15 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d32e81fe8..0c75dd4e4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -69,6 +69,11 @@ class GuiConfigListener final : public ConfigListener A_DELETE_COPY(GuiConfigListener) + virtual ~GuiConfigListener() + { + CHECKLISTENERS + } + void optionChanged(const std::string &name) { if (!mGui) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index f523df908..3381b156a 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -234,6 +234,7 @@ Theme::~Theme() { delete_all(mSkins); config.removeListener("guialpha", this); + CHECKLISTENERS delete_all(mProgressColors); } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 05807126f..d2dddb4d8 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -98,6 +98,7 @@ Viewport::Viewport() : Viewport::~Viewport() { config.removeListeners(this); + CHECKLISTENERS delete mPopupMenu; mPopupMenu = nullptr; delete mBeingPopup; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index d4eefe69c..664263518 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -71,6 +71,7 @@ AvatarListBox::AvatarListBox(const Widget2 *const widget, AvatarListBox::~AvatarListBox() { config.removeListeners(this); + CHECKLISTENERS instances--; diff --git a/src/gui/widgets/tabs/guildchattab.cpp b/src/gui/widgets/tabs/guildchattab.cpp index 4188a8843..69a4faaf3 100644 --- a/src/gui/widgets/tabs/guildchattab.cpp +++ b/src/gui/widgets/tabs/guildchattab.cpp @@ -49,6 +49,7 @@ GuildChatTab::GuildChatTab(const Widget2 *const widget) : GuildChatTab::~GuildChatTab() { config.removeListeners(this); + CHECKLISTENERS } bool GuildChatTab::handleCommand(const std::string &type, diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 5d7f792d9..332843a86 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -180,6 +180,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : WindowMenu::~WindowMenu() { config.removeListener("autohideButtons", this); + CHECKLISTENERS delete mTextPopup; mTextPopup = nullptr; diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index b502dd01d..61dc7286c 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -344,6 +344,7 @@ BotCheckerWindow::BotCheckerWindow(): BotCheckerWindow::~BotCheckerWindow() { config.removeListener("enableBotCheker", this); + CHECKLISTENERS } void BotCheckerWindow::slowLogic() diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index eade8b063..79cf0eff3 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -310,6 +310,7 @@ ChatWindow::ChatWindow(): ChatWindow::~ChatWindow() { config.removeListeners(this); + CHECKLISTENERS saveState(); config.setValue("ReturnToggles", mReturnToggles); removeAllWhispers(); diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 9ac4a9e26..7aefa285b 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -87,6 +87,7 @@ Minimap::~Minimap() { config.setValue(getWindowName() + "Show", mShow); config.removeListeners(this); + CHECKLISTENERS if (mMapImage) { diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 3b5d0d772..1c2a6cc1d 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -209,6 +209,7 @@ void NpcDialog::postInit() NpcDialog::~NpcDialog() { config.removeListeners(this); + CHECKLISTENERS clearLayout(); if (mPlayerBox) diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index c4f096c72..2e32e13fe 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -142,6 +142,7 @@ void WhoIsOnline::postInit() WhoIsOnline::~WhoIsOnline() { config.removeListeners(this); + CHECKLISTENERS if (mThread && SDL_GetThreadID(mThread)) SDL_WaitThread(mThread, nullptr); -- cgit v1.2.3-70-g09d2