diff options
Diffstat (limited to 'indra/newview/llpanelpeoplemenus.cpp')
-rw-r--r-- | indra/newview/llpanelpeoplemenus.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index c1c10e6022..7e184c78a8 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -55,6 +55,22 @@ ContextMenu::ContextMenu() { } +ContextMenu::~ContextMenu() +{ + // do not forget delete LLContextMenu* mMenu. + // It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw() + // via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel. + // we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725 + + // menu holder deletes its menus on viewer exit, so we have no way to determine if instance + // of mMenu has already been deleted except of using LLHandle. EXT-4762. + if (!mMenuHandle.isDead()) + { + mMenu->die(); + mMenu = NULL; + } +} + void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y) { if (mMenu) @@ -77,6 +93,7 @@ void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, std::copy(uuids.begin(), uuids.end(), mUUIDs.begin()); mMenu = createMenu(); + mMenuHandle = mMenu->getHandle(); mMenu->show(x, y); LLMenuGL::showPopup(spawning_view, mMenu, x, y); } @@ -147,11 +164,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) if (item == std::string("can_block")) { const LLUUID& id = mUUIDs.front(); - std::string firstname, lastname; - gCacheName->getName(id, firstname, lastname); - bool is_linden = !LLStringUtil::compareStrings(lastname, "Linden"); - bool is_self = id == gAgentID; - return !is_self && !is_linden; + return LLAvatarActions::canBlock(id); } else if (item == std::string("can_add")) { @@ -183,20 +196,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) } else if (item == std::string("can_call")) { - bool result = false; - std::vector<LLUUID>::const_iterator - id = mUUIDs.begin(), - uuids_end = mUUIDs.end(); - - for (;id != uuids_end; ++id) - { - if (LLAvatarActions::canCall(*id)) - { - result = true; - break; - } - } - return result; + return LLAvatarActions::canCall(); } return false; } |