This should fix some problems I experienced later. At least, I can't reproduce them anymore
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16920 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d70f0203a2
commit
793fde40eb
@ -1266,15 +1266,16 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
||||
bool invalidateLayout = false;
|
||||
|
||||
bool locked = LockLooper();
|
||||
BWindow *window = Window();
|
||||
|
||||
// The plan is simple: If we're given a BMenuItem directly, we use it
|
||||
// and ignore index and count. Otherwise, we use them instead.
|
||||
if (item != NULL) {
|
||||
if (fItems.RemoveItem(item)) {
|
||||
if (item == fSelected)
|
||||
if (item == fSelected && window != NULL)
|
||||
SelectItem(NULL);
|
||||
item->SetSuper(NULL);
|
||||
item->Uninstall();
|
||||
item->SetSuper(NULL);
|
||||
if (deleteItems)
|
||||
delete item;
|
||||
success = invalidateLayout = true;
|
||||
@ -1290,10 +1291,10 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
||||
item = static_cast<BMenuItem*>(fItems.ItemAt(i));
|
||||
if (item != NULL) {
|
||||
if (fItems.RemoveItem(item)) {
|
||||
if (item == fSelected)
|
||||
if (item == fSelected && window != NULL)
|
||||
SelectItem(NULL);
|
||||
item->SetSuper(NULL);
|
||||
item->Uninstall();
|
||||
item->SetSuper(NULL);
|
||||
if (deleteItems)
|
||||
delete item;
|
||||
success = true;
|
||||
@ -1307,8 +1308,10 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidateLayout && locked && fResizeToFit)
|
||||
InvalidateLayout();
|
||||
if (invalidateLayout && locked && fResizeToFit) {
|
||||
LayoutItems(0);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
if (locked)
|
||||
UnlockLooper();
|
||||
|
@ -630,7 +630,7 @@ BMenuItem::Uninstall()
|
||||
if (Target() == fWindow)
|
||||
SetTarget(BMessenger());
|
||||
|
||||
if (fShortcutChar != 0 && fModifiers != 0 && fWindow != NULL)
|
||||
if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow != NULL)
|
||||
fWindow->RemoveShortcut(fShortcutChar, fModifiers);
|
||||
|
||||
fWindow = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user