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
@ -80,12 +80,12 @@ class BNavMenu : public BSlowMenu {
|
|||||||
BWindow *parentWindow = NULL, const BObjectList<BString> *list = NULL);
|
BWindow *parentWindow = NULL, const BObjectList<BString> *list = NULL);
|
||||||
// parentWindow, if specified, will be closed if nav menu item invoked
|
// parentWindow, if specified, will be closed if nav menu item invoked
|
||||||
// with option held down
|
// with option held down
|
||||||
|
|
||||||
virtual ~BNavMenu();
|
virtual ~BNavMenu();
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
|
|
||||||
void SetNavDir(const entry_ref *);
|
void SetNavDir(const entry_ref *);
|
||||||
void ForceRebuild();
|
void ForceRebuild();
|
||||||
bool NeedsToRebuild() const;
|
bool NeedsToRebuild() const;
|
||||||
@ -96,7 +96,7 @@ class BNavMenu : public BSlowMenu {
|
|||||||
BMessenger Target();
|
BMessenger Target();
|
||||||
|
|
||||||
void SetTypesList(const BObjectList<BString> *list);
|
void SetTypesList(const BObjectList<BString> *list);
|
||||||
const BObjectList<BString> *TypesList() const;
|
const BObjectList<BString> *TypesList() const;
|
||||||
|
|
||||||
void AddNavDir(const Model *model, uint32 what, BHandler *target,
|
void AddNavDir(const Model *model, uint32 what, BHandler *target,
|
||||||
bool populateSubmenu);
|
bool populateSubmenu);
|
||||||
@ -121,7 +121,7 @@ class BNavMenu : public BSlowMenu {
|
|||||||
protected:
|
protected:
|
||||||
virtual bool StartBuildingItemList();
|
virtual bool StartBuildingItemList();
|
||||||
virtual bool AddNextItem();
|
virtual bool AddNextItem();
|
||||||
virtual void DoneBuildingItemList();
|
virtual void DoneBuildingItemList();
|
||||||
virtual void ClearMenuBuildingState();
|
virtual void ClearMenuBuildingState();
|
||||||
|
|
||||||
void BuildVolumeMenu();
|
void BuildVolumeMenu();
|
||||||
@ -142,7 +142,7 @@ class BNavMenu : public BSlowMenu {
|
|||||||
EntryListBase *fContainer;
|
EntryListBase *fContainer;
|
||||||
bool fIteratingDesktop;
|
bool fIteratingDesktop;
|
||||||
|
|
||||||
const BObjectList<BString> *fTypesList;
|
BObjectList<BString> *fTypesList;
|
||||||
|
|
||||||
TrackingHookData fTrackingHook;
|
TrackingHookData fTrackingHook;
|
||||||
};
|
};
|
||||||
|
@ -263,8 +263,10 @@ BNavMenu::BNavMenu(const char* title, uint32 message, const BHandler* target,
|
|||||||
fFlags(0),
|
fFlags(0),
|
||||||
fItemList(0),
|
fItemList(0),
|
||||||
fContainer(0),
|
fContainer(0),
|
||||||
fTypesList(list)
|
fTypesList(new BObjectList<BString>(10, true))
|
||||||
{
|
{
|
||||||
|
if (list != NULL)
|
||||||
|
*fTypesList = *list;
|
||||||
InitIconPreloader();
|
InitIconPreloader();
|
||||||
|
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
@ -292,8 +294,10 @@ BNavMenu::BNavMenu(const char* title, uint32 message,
|
|||||||
fFlags(0),
|
fFlags(0),
|
||||||
fItemList(0),
|
fItemList(0),
|
||||||
fContainer(0),
|
fContainer(0),
|
||||||
fTypesList(list)
|
fTypesList(new BObjectList<BString>(10, true))
|
||||||
{
|
{
|
||||||
|
if (list != NULL)
|
||||||
|
*fTypesList = *list;
|
||||||
InitIconPreloader();
|
InitIconPreloader();
|
||||||
|
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
@ -313,6 +317,7 @@ BNavMenu::BNavMenu(const char* title, uint32 message,
|
|||||||
|
|
||||||
BNavMenu::~BNavMenu()
|
BNavMenu::~BNavMenu()
|
||||||
{
|
{
|
||||||
|
delete fTypesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -814,7 +819,7 @@ BNavMenu::SetShowParent(bool show)
|
|||||||
void
|
void
|
||||||
BNavMenu::SetTypesList(const BObjectList<BString>* list)
|
BNavMenu::SetTypesList(const BObjectList<BString>* list)
|
||||||
{
|
{
|
||||||
fTypesList = list;
|
*fTypesList = *list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user