From 17ef6bf3cd4e909b497da5bacd93577c55a303e5 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 7 Mar 2015 00:44:25 +0100 Subject: [PATCH] Properly release Growl during viewer shutdown --- indra/newview/growlmanager.cpp | 11 ++++++++++- indra/newview/growlmanager.h | 3 ++- indra/newview/growlnotifierwin.cpp | 13 +++++++++++-- indra/newview/growlnotifierwin.h | 3 ++- indra/newview/llappviewer.cpp | 7 +++++++ indra/newview/llstartup.cpp | 2 +- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/indra/newview/growlmanager.cpp b/indra/newview/growlmanager.cpp index bf14e15618..7d6fa3034b 100644 --- a/indra/newview/growlmanager.cpp +++ b/indra/newview/growlmanager.cpp @@ -402,11 +402,20 @@ bool GrowlManager::shouldNotify() return (activated || (!gViewerWindow->getWindow()->getVisible() || !gFocusMgr.getAppHasFocus())); } -void GrowlManager::InitiateManager() +void GrowlManager::initiateManager() { gGrowlManager = new GrowlManager(); } +void GrowlManager::destroyManager() +{ + if (gGrowlManager) + { + delete gGrowlManager; + gGrowlManager = NULL; + } +} + bool GrowlManager::isUsable() { return (gGrowlManager && gGrowlManager->mNotifier && gGrowlManager->mNotifier->isUsable()); diff --git a/indra/newview/growlmanager.h b/indra/newview/growlmanager.h index b4ec757ca6..a5481d55ba 100644 --- a/indra/newview/growlmanager.h +++ b/indra/newview/growlmanager.h @@ -62,7 +62,8 @@ public: void notify(const std::string& notification_title, const std::string& notification_message, const std::string& notification_type); BOOL tick(); - static void InitiateManager(); + static void initiateManager(); + static void destroyManager(); static bool isUsable(); private: diff --git a/indra/newview/growlnotifierwin.cpp b/indra/newview/growlnotifierwin.cpp index 1bdb83012e..103aea3bde 100644 --- a/indra/newview/growlnotifierwin.cpp +++ b/indra/newview/growlnotifierwin.cpp @@ -40,8 +40,17 @@ GrowlNotifierWin::GrowlNotifierWin() : mApplicationName(""), mGrowlImpl(NULL) { - LL_INFOS("GrowlNotifierWin") << "Windows growl notifications initialised." << LL_ENDL; - + LL_INFOS("GrowlNotifierWin") << "Windows growl notifier initialized." << LL_ENDL; +} + +GrowlNotifierWin::~GrowlNotifierWin() +{ + LL_INFOS("GrowlNotifierWin") << "Windows growl notifier destroyed." << LL_ENDL; + if (mGrowlImpl) + { + delete mGrowlImpl; + mGrowlImpl = NULL; + } } void GrowlNotifierWin::registerApplication(const std::string& application, const std::set& notificationTypes) diff --git a/indra/newview/growlnotifierwin.h b/indra/newview/growlnotifierwin.h index 3be6252d2f..df7ffcc208 100644 --- a/indra/newview/growlnotifierwin.h +++ b/indra/newview/growlnotifierwin.h @@ -42,7 +42,8 @@ class GrowlNotifierWin : public GrowlNotifier { public: GrowlNotifierWin(); - + virtual ~GrowlNotifierWin(); + void showNotification(const std::string& notification_title, const std::string& notification_message, const std::string& notification_type); bool isUsable(); void registerApplication(const std::string& application, const std::set& notificationTypes); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1bace96c34..af76785e89 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -247,6 +247,9 @@ #include "llviewereventrecorder.h" #include "llleapmotioncontroller.h" +#if HAS_GROWL +#include "growlmanager.h" +#endif // *FIX: These extern globals should be cleaned up. @@ -1972,6 +1975,10 @@ bool LLAppViewer::cleanup() // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); +#if HAS_GROWL + GrowlManager::destroyManager(); +#endif + //dump scene loading monitor results LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2dbc5e648d..a2b52242e7 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -592,7 +592,7 @@ bool idle_startup() // [/RLVa:KB] #if HAS_GROWL - GrowlManager::InitiateManager(); + GrowlManager::initiateManager(); #endif // Store current font and skin for system info (FIRE-6806)