From 8e7912f3821b3e20b528239b7ebfe0c6a9bffc71 Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Fri, 9 May 2014 23:06:53 +0100 Subject: MAINT-4009: Improved patching of a memory leak for when menu items are created before the viewer window initialization has created the menu holder. See also changeset bc0743639926a84b38b4907d252eff1cc0498c7d. --- indra/newview/llmediactrl.cpp | 8 +++++--- indra/newview/llviewerwindow.cpp | 6 ------ 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 90d4dd093b..c4b68bb7e1 100755 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -390,10 +390,12 @@ BOOL LLMediaCtrl::postBuild () LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this)); - // stinson 05/05/2014 : cannot assert on the menu container being NULL because it will be during the processing of main_view.xml - // llassert(LLMenuGL::sMenuContainer != NULL); + // stinson 05/05/2014 : use this as the parent of the context menu if the static menu + // container has yet to be created + LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast(LLMenuGL::sMenuContainer) : dynamic_cast(this); + llassert(menuParent != NULL); mContextMenu = LLUICtrlFactory::getInstance()->createFromFile( - "menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); + "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance()); setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2)); return TRUE; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 621baee0e6..2cb8e6a3ab 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1911,12 +1911,6 @@ void LLViewerWindow::initBase() gMenuHolder = getRootView()->getChild("Menu Holder"); LLMenuGL::sMenuContainer = gMenuHolder; - - // stinson 05/05/2014 : the panel_progress.xml references a LLMediaCtrl() class - // which creates some menu items. However, because the Menu Holder is not initialized then, we need to - // update the parent for the menu items so they will be properly cleaned up. - LLMediaCtrl* mediaCtrl = getRootView()->findChild("login_media_panel"); - mediaCtrl->updateContextMenuParent(LLMenuGL::sMenuContainer); } void LLViewerWindow::initWorldUI() -- cgit v1.2.3