Fix crash when dragging files onto nav menus.
- BNavMenu now keeps its own copy of the cached types list that's passed to it. In some circumstances it could happen that the container window would delete the list and consequently the nav menu would wind up with a pointer to an invalid object. Probably a regression from the async mouse tracking rewrites.
This commit is contained in:
parent
1d6d4b7872
commit
9335e141ba
@ -142,7 +142,7 @@ class BNavMenu : public BSlowMenu {
|
||||
EntryListBase *fContainer;
|
||||
bool fIteratingDesktop;
|
||||
|
||||
const BObjectList<BString> *fTypesList;
|
||||
BObjectList<BString> *fTypesList;
|
||||
|
||||
TrackingHookData fTrackingHook;
|
||||
};
|
||||
|
@ -263,8 +263,10 @@ BNavMenu::BNavMenu(const char* title, uint32 message, const BHandler* target,
|
||||
fFlags(0),
|
||||
fItemList(0),
|
||||
fContainer(0),
|
||||
fTypesList(list)
|
||||
fTypesList(new BObjectList<BString>(10, true))
|
||||
{
|
||||
if (list != NULL)
|
||||
*fTypesList = *list;
|
||||
InitIconPreloader();
|
||||
|
||||
SetFont(be_plain_font);
|
||||
@ -292,8 +294,10 @@ BNavMenu::BNavMenu(const char* title, uint32 message,
|
||||
fFlags(0),
|
||||
fItemList(0),
|
||||
fContainer(0),
|
||||
fTypesList(list)
|
||||
fTypesList(new BObjectList<BString>(10, true))
|
||||
{
|
||||
if (list != NULL)
|
||||
*fTypesList = *list;
|
||||
InitIconPreloader();
|
||||
|
||||
SetFont(be_plain_font);
|
||||
@ -313,6 +317,7 @@ BNavMenu::BNavMenu(const char* title, uint32 message,
|
||||
|
||||
BNavMenu::~BNavMenu()
|
||||
{
|
||||
delete fTypesList;
|
||||
}
|
||||
|
||||
|
||||
@ -814,7 +819,7 @@ BNavMenu::SetShowParent(bool show)
|
||||
void
|
||||
BNavMenu::SetTypesList(const BObjectList<BString>* list)
|
||||
{
|
||||
fTypesList = list;
|
||||
*fTypesList = *list;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user