summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorStinson Linden <stinson@lindenlab.com>2014-05-05 23:24:34 +0100
committerStinson Linden <stinson@lindenlab.com>2014-05-05 23:24:34 +0100
commit001621dfc21942a6ae0075ca3eef31720f42477b (patch)
treecd86dcd3b02df87a76ee993e4bf98ec4e8223f5f /indra/newview
parent205503dd84479be4989e5f5567a1d187cc0e71eb (diff)
MAINT-4009: Patching a small memory leak for when menu items were being created before the viewer window initialization had created the menu holder. Also, added llasserts in other cases when referencing the menu holder to ensure the holder is non-null.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llchiclet.cpp1
-rwxr-xr-xindra/newview/lllistcontextmenu.cpp1
-rwxr-xr-xindra/newview/llmediactrl.cpp7
-rwxr-xr-xindra/newview/llmediactrl.h2
-rwxr-xr-xindra/newview/llpaneloutfitedit.cpp2
-rwxr-xr-xindra/newview/llpanelteleporthistory.cpp2
-rwxr-xr-xindra/newview/llviewerwindow.cpp6
7 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index b1dce42dfd..c0823182c0 100755
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -204,6 +204,7 @@ void LLNotificationChiclet::createMenu()
enable_registrar.add("NotificationWellChicletMenu.EnableItem",
boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
("menu_notification_well_button.xml",
LLMenuGL::sMenuContainer,
diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp
index a624c9fb87..6bda8b1d0d 100755
--- a/indra/newview/lllistcontextmenu.cpp
+++ b/indra/newview/lllistcontextmenu.cpp
@@ -110,6 +110,7 @@ void LLListContextMenu::handleMultiple(functor_t functor, const uuid_vec_t& ids)
// static
LLContextMenu* LLListContextMenu::createFromFile(const std::string& filename)
{
+ llassert(LLMenuGL::sMenuContainer != NULL);
return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
filename, LLContextMenu::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 323445afa6..90d4dd093b 100755
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -390,6 +390,8 @@ 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);
mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2));
@@ -1117,3 +1119,8 @@ void LLMediaCtrl::setTrustedContent(bool trusted)
mMediaSource->setTrustedBrowser(trusted);
}
}
+
+void LLMediaCtrl::updateContextMenuParent(LLView* pNewParent)
+{
+ mContextMenu->updateParent(pNewParent);
+}
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 5978a7a344..b07eb356ae 100755
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -168,6 +168,8 @@ public:
LLUUID getTextureID() {return mMediaTextureID;}
+ void updateContextMenuParent(LLView* pNewParent);
+
protected:
void convertInputCoords(S32& x, S32& y);
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index e48aa88937..158038c4f7 100755
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -159,6 +159,7 @@ public:
registrar.add("Wearable.Create", boost::bind(onCreate, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
llassert(menu);
@@ -228,6 +229,7 @@ public:
enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_add_wearable_gear.xml",
LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 8fddd9523f..652d2be6f6 100755
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -341,6 +341,7 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
registrar.add("TeleportHistory.CopyToClipboard",boost::bind(&LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard, this));
// create the context menu from the XUI
+ llassert(LLMenuGL::sMenuContainer != NULL);
return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_item.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
@@ -935,6 +936,7 @@ void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y
registrar.add("TeleportHistory.TabClose", boost::bind(&LLTeleportHistoryPanel::onAccordionTabClose, this, tab));
// create the context menu from the XUI
+ llassert(LLMenuGL::sMenuContainer != NULL);
mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 3dad782715..621baee0e6 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1910,9 +1910,13 @@ void LLViewerWindow::initBase()
setProgressCancelButtonVisible(FALSE);
gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
-
LLMenuGL::sMenuContainer = gMenuHolder;
+ // stinson 05/05/2014 : the panel_progress.xml references a LLMediaCtrl(<web_browser></web_browser>) 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<LLMediaCtrl>("login_media_panel");
+ mediaCtrl->updateContextMenuParent(LLMenuGL::sMenuContainer);
}
void LLViewerWindow::initWorldUI()