From af4b2247005268dbf92f8bc6994c7048b1035454 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 29 Sep 2010 16:24:31 -0700 Subject: final fix for llcontextmenugl crash on exit --- indra/newview/lllistcontextmenu.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'indra/newview/lllistcontextmenu.cpp') diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp index ea744072d2..6421ab42bf 100644 --- a/indra/newview/lllistcontextmenu.cpp +++ b/indra/newview/lllistcontextmenu.cpp @@ -36,7 +36,6 @@ #include "llviewermenu.h" // for LLViewerMenuHolderGL LLListContextMenu::LLListContextMenu() -: mMenu(NULL) { } @@ -51,23 +50,22 @@ LLListContextMenu::~LLListContextMenu() // of mMenu has already been deleted except of using LLHandle. EXT-4762. if (!mMenuHandle.isDead()) { - mMenu->die(); - mMenu = NULL; + mMenuHandle.get()->die(); } } void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) { - if (mMenu) + LLContextMenu* menup = mMenuHandle.get(); + if (menup) { //preventing parent (menu holder) from deleting already "dead" context menus on exit - LLView* parent = mMenu->getParent(); + LLView* parent = menup->getParent(); if (parent) { - parent->removeChild(mMenu); + parent->removeChild(menup); } - delete mMenu; - mMenu = NULL; + delete menup; mUUIDs.clear(); } @@ -79,23 +77,23 @@ void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 mUUIDs.resize(uuids.size()); std::copy(uuids.begin(), uuids.end(), mUUIDs.begin()); - mMenu = createMenu(); - if (!mMenu) + menup = createMenu(); + if (!menup) { llwarns << "Context menu creation failed" << llendl; return; } - mMenuHandle = mMenu->getHandle(); - mMenu->show(x, y); - LLMenuGL::showPopup(spawning_view, mMenu, x, y); + mMenuHandle = menup->getHandle(); + menup->show(x, y); + LLMenuGL::showPopup(spawning_view, menup, x, y); } void LLListContextMenu::hide() { - if(mMenu) + if(mMenuHandle.get()) { - mMenu->hide(); + mMenuHandle.get()->hide(); } } -- cgit v1.2.3