diff options
author | Stinson Linden <stinson@lindenlab.com> | 2014-05-27 22:45:02 +0100 |
---|---|---|
committer | Stinson Linden <stinson@lindenlab.com> | 2014-05-27 22:45:02 +0100 |
commit | c84217cc5bf49354b39ea3521e4805c791a15c8c (patch) | |
tree | 25410eb845faefd9bd0975dbeacc1bd7598208b1 | |
parent | fdc787cc06cd09a70e13cfb9da6f0aecd5d5d50f (diff) |
MAINT-4009: Ensuring that the view listeners are properly cleaned up at app close.
-rwxr-xr-x | indra/llui/llmenugl.cpp | 1 | ||||
-rwxr-xr-x | indra/llui/llmenugl.h | 17 | ||||
-rwxr-xr-x | indra/newview/llviewerwindow.cpp | 3 |
3 files changed, 20 insertions, 1 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 7383a8c307..604dc92789 100755 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -63,6 +63,7 @@ // static LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; +view_listener_t::listener_map_t view_listener_t::sListeners; S32 MENU_BAR_HEIGHT = 0; S32 MENU_BAR_WIDTH = 0; diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index feafaab199..ae9b169691 100755 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -895,7 +895,8 @@ class view_listener_t : public boost::signals2::trackable { public: virtual bool handleEvent(const LLSD& userdata) = 0; - virtual ~view_listener_t() {} + view_listener_t() { sListeners.insert(this); } + virtual ~view_listener_t() { sListeners.erase(this); } static void addEnable(view_listener_t* listener, const std::string& name) { @@ -913,6 +914,20 @@ public: addEnable(listener, name); addCommit(listener, name); } + + static void cleanup() + { + listener_vector_t listeners(sListeners.begin(), sListeners.end()); + sListeners.clear(); + + std::for_each(listeners.begin(), listeners.end(), DeletePointer()); + listeners.clear(); + } + +private: + typedef std::set<view_listener_t*> listener_map_t; + typedef std::vector<view_listener_t*> listener_vector_t; + static listener_map_t sListeners; }; #endif // LL_LLMENUGL_H diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index fc5fb39f4e..7d2771802e 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2088,6 +2088,9 @@ void LLViewerWindow::shutdownViews() // access to gMenuHolder cleanup_menus(); LL_INFOS() << "menus destroyed." << LL_ENDL ; + + view_listener_t::cleanup(); + LL_INFOS() << "view listeners destroyed." << LL_ENDL ; // Delete all child views. delete mRootView; |