Also nullify other saved items on delete

This commit is contained in:
John Scipione
2013-04-07 14:46:24 -04:00
parent 1dccb7aaaf
commit 86c4eae3ce
+7 -1
View File
@@ -464,7 +464,7 @@ TExpandoMenuBar::MouseMoved(BPoint where, uint32 code, const BMessage* message)
switch (code) { switch (code) {
case B_ENTERED_VIEW: case B_ENTERED_VIEW:
// fPreviousDragTargetItem should always be NULL here anyways. // fPreviousDragTargetItem should always be NULL here anyways.
if (fPreviousDragTargetItem) if (fPreviousDragTargetItem != NULL)
_FinishedDrag(); _FinishedDrag();
fBarView->CacheDragData(message); fBarView->CacheDragData(message);
@@ -748,6 +748,10 @@ TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
BAutolock locker(sMonLocker); BAutolock locker(sMonLocker);
// make the update thread wait // make the update thread wait
RemoveItem(i); RemoveItem(i);
if (item == fPreviousDragTargetItem)
fPreviousDragTargetItem = NULL;
if (item == fLastMousedOverItem)
fLastMousedOverItem = NULL;
if (item == fLastClickedItem) if (item == fLastClickedItem)
fLastClickedItem = NULL; fLastClickedItem = NULL;
delete item; delete item;
@@ -755,6 +759,8 @@ TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
ItemAt(i))) != NULL) { ItemAt(i))) != NULL) {
// Also remove window items (if there are any) // Also remove window items (if there are any)
RemoveItem(i); RemoveItem(i);
if (windowItem == fLastMousedOverItem)
fLastMousedOverItem = NULL;
if (windowItem == fLastClickedItem) if (windowItem == fLastClickedItem)
fLastClickedItem = NULL; fLastClickedItem = NULL;
delete windowItem; delete windowItem;