diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2022-10-19 16:28:34 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2022-10-19 16:28:34 -0400 |
commit | 5456af4c8ce8c2bef7d544cd8a928ea399832756 (patch) | |
tree | c510874defae368bce1edd6b4c7c1ae0e0bf4587 /indra/newview/llnetmap.cpp | |
parent | bbd8df15de6b8f9b321f251c3e764ea654d5ecc7 (diff) |
Fix various menu leaks and lazy creation in chiclets, bump floater, media controls, and the mini map
Diffstat (limited to 'indra/newview/llnetmap.cpp')
-rw-r--r-- | indra/newview/llnetmap.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 1240ce7c0f..245fec30c9 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -93,8 +93,7 @@ LLNetMap::LLNetMap (const Params & p) mObjectImagep(), mClosestAgentToCursor(), mClosestAgentAtLastRightClick(), - mToolTipMsg(), - mPopupMenu(NULL) + mToolTipMsg() { mScale = gSavedSettings.getF32("MiniMapScale"); mPixelsPerMeter = mScale / REGION_WIDTH_METERS; @@ -103,6 +102,12 @@ LLNetMap::LLNetMap (const Params & p) LLNetMap::~LLNetMap() { + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) + { + menu->die(); + mPopupMenuHandle.markDead(); + } } BOOL LLNetMap::postBuild() @@ -112,7 +117,8 @@ BOOL LLNetMap::postBuild() registrar.add("Minimap.Zoom", boost::bind(&LLNetMap::handleZoom, this, _2)); registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + mPopupMenuHandle = menu->getHandle(); return TRUE; } @@ -859,12 +865,13 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (mPopupMenu) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) { - mPopupMenu->buildDrawLabels(); - mPopupMenu->updateParent(LLMenuGL::sMenuContainer); - mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); - LLMenuGL::showPopup(this, mPopupMenu, x, y); + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + menu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); + LLMenuGL::showPopup(this, menu, x, y); } return TRUE; } @@ -990,9 +997,10 @@ void LLNetMap::handleZoom(const LLSD& userdata) void LLNetMap::handleStopTracking (const LLSD& userdata) { - if (mPopupMenu) + auto menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get()); + if (menu) { - mPopupMenu->setItemEnabled ("Stop Tracking", false); + menu->setItemEnabled ("Stop Tracking", false); LLTracker::stopTracking (LLTracker::isTracking(NULL)); } } |