summaryrefslogtreecommitdiff
path: root/indra/llui/llmenugl.h
diff options
context:
space:
mode:
authorStinson Linden <stinson@lindenlab.com>2014-05-27 22:45:02 +0100
committerStinson Linden <stinson@lindenlab.com>2014-05-27 22:45:02 +0100
commitc84217cc5bf49354b39ea3521e4805c791a15c8c (patch)
tree25410eb845faefd9bd0975dbeacc1bd7598208b1 /indra/llui/llmenugl.h
parentfdc787cc06cd09a70e13cfb9da6f0aecd5d5d50f (diff)
MAINT-4009: Ensuring that the view listeners are properly cleaned up at app close.
Diffstat (limited to 'indra/llui/llmenugl.h')
-rwxr-xr-xindra/llui/llmenugl.h17
1 files changed, 16 insertions, 1 deletions
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