summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-07-19 15:15:04 -0700
committerRichard Linden <none@none>2010-07-19 15:15:04 -0700
commit39ae8785b459255f5fcc432cb2b5d5bed3ab2ba9 (patch)
tree745b1fe5fbe7a8bed81794db5bc6a728867e5c03 /indra
parentb4aed58dec573f057dc80ef083a86302b36d149d (diff)
EXT-8448 FIX [crashhunters] Crash in LLFolderBridge::folderOptionsMenu()
reviewed by Callum
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfolderview.cpp2
-rw-r--r--indra/newview/llinventorybridge.cpp31
-rw-r--r--indra/newview/llinventorybridge.h18
-rw-r--r--indra/newview/llinventorypanel.cpp2
-rw-r--r--indra/newview/llplacesinventorybridge.cpp2
5 files changed, 34 insertions, 21 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 87c5a830e9..14d3bda8e9 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -1195,7 +1195,7 @@ void LLFolderView::propertiesSelectedItems( void )
void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type)
{
- LLFolderBridge *folder_bridge = LLFolderBridge::sSelf;
+ LLFolderBridge *folder_bridge = LLFolderBridge::sSelf.get();
if (!folder_bridge) return;
LLViewerInventoryCategory *cat = folder_bridge->getCategory();
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 578c68410b..4ac9edecbe 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1444,7 +1444,7 @@ bool LLItemBridge::isRemoveAction(std::string action) const
// | LLFolderBridge |
// +=================================================+
-LLFolderBridge* LLFolderBridge::sSelf=NULL;
+LLHandle<LLFolderBridge> LLFolderBridge::sSelf;
// Can be moved to another folder
BOOL LLFolderBridge::isItemMovable() const
@@ -2388,8 +2388,11 @@ void LLFolderBridge::pasteLinkFromClipboard()
void LLFolderBridge::staticFolderOptionsMenu()
{
- if (!sSelf) return;
- sSelf->folderOptionsMenu();
+ LLFolderBridge* selfp = sSelf.get();
+ if (selfp)
+ {
+ selfp->folderOptionsMenu();
+ }
}
void LLFolderBridge::folderOptionsMenu()
@@ -2466,11 +2469,15 @@ void LLFolderBridge::folderOptionsMenu()
}
mItems.push_back(std::string("Outfit Separator"));
}
- hide_context_entries(*mMenu, mItems, disabled_items, TRUE);
+ LLMenuGL* menup = dynamic_cast<LLMenuGL*>(mMenu.get());
+ if (menup)
+ {
+ hide_context_entries(*menup, mItems, disabled_items, TRUE);
- // Reposition the menu, in case we're adding items to an existing menu.
- mMenu->needsArrange();
- mMenu->arrangeAndClear();
+ // Reposition the menu, in case we're adding items to an existing menu.
+ menup->needsArrange();
+ menup->arrangeAndClear();
+ }
}
BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
@@ -2512,6 +2519,10 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
mDisabledItems.push_back(std::string("New Body Parts"));
}
+ // clear out old menu and folder pointers
+ mMenu.markDead();
+ sSelf.markDead();
+
if(trash_id == mUUID)
{
// This is the trash.
@@ -2587,9 +2598,8 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
mWearables=TRUE;
}
-
- mMenu = &menu;
- sSelf = this;
+ mMenu = menu.getHandle();
+ sSelf = getHandle();
}
// Preemptively disable system folder removal if more than one item selected.
@@ -2619,6 +2629,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
{
folders.push_back(category->getUUID());
}
+
LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
fetch->startFetch();
inc_busy_count();
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 9dc50b542d..91055eb906 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -230,8 +230,8 @@ public:
const LLUUID& uuid) :
LLInvFVBridge(inventory, root, uuid),
mCallingCards(FALSE),
- mWearables(FALSE),
- mMenu(NULL) {}
+ mWearables(FALSE)
+ {}
BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop);
BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop);
@@ -272,6 +272,7 @@ public:
static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
LLViewerInventoryCategory* getCategory() const;
+ LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
protected:
//--------------------------------------------------------------------
@@ -305,16 +306,17 @@ protected:
// Messy hacks for handling folder options
//--------------------------------------------------------------------
public:
- static LLFolderBridge* sSelf;
+ static LLHandle<LLFolderBridge> sSelf;
static void staticFolderOptionsMenu();
void folderOptionsMenu();
private:
- BOOL mCallingCards;
- BOOL mWearables;
- LLMenuGL* mMenu;
- menuentry_vec_t mItems;
- menuentry_vec_t mDisabledItems;
+ BOOL mCallingCards;
+ BOOL mWearables;
+ LLHandle<LLView> mMenu;
+ menuentry_vec_t mItems;
+ menuentry_vec_t mDisabledItems;
+ LLRootHandle<LLFolderBridge> mHandle;
};
class LLTextureBridge : public LLItemBridge
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 5af99f3c8f..ac92f41624 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -790,7 +790,7 @@ void LLInventoryPanel::doToSelected(const LLSD& userdata)
void LLInventoryPanel::doCreate(const LLSD& userdata)
{
- menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf, userdata);
+ menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf.get(), userdata);
}
bool LLInventoryPanel::beginIMSession()
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index f59a55cb8b..18a91b0eb0 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -115,7 +115,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// they should be synchronized with Places/My Landmarks/Gear menu. See EXT-1601
// repeat parent functionality
- sSelf = this; // necessary for "New Folder" functionality
+ sSelf = getHandle(); // necessary for "New Folder" functionality
hide_context_entries(menu, items, disabled_items);
}