Lock the root menu before calling BMenuItem::Invoke(). This fixes #3842, although in some circumstances could introduce a deadlock (if someone does strange things in Invoke(), for example).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30662 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2009-05-07 21:13:24 +00:00
parent a48d16a026
commit c6278c8f49

View File

@ -2279,7 +2279,18 @@ BMenu::_InvokeItem(BMenuItem *item, bool now)
UnlockLooper();
}
item->Invoke();
// Lock the root menu window before calling BMenuItem::Invoke()
BMenu *parent = this;
BMenu *rootMenu = NULL;
do {
rootMenu = parent;
parent = rootMenu->Supermenu();
} while (parent != NULL);
if (rootMenu->LockLooper()) {
item->Invoke();
rootMenu->UnlockLooper();
}
}