Now checks if locking the looper succeeded.

Now hides the window before removing itself to prevent a superfluous drawing update.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15410 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-12-08 10:46:54 +00:00
parent ecc3280f6b
commit 1d44f6791d
+11 -3
View File
@@ -1056,13 +1056,21 @@ BMenu::_show(bool selectFirstItem)
void void
BMenu::_hide() BMenu::_hide()
{ {
if (fCachedMenuWindow != NULL) { if (!LockLooper())
fCachedMenuWindow->Lock(); return;
if (fCachedMenuWindow == NULL) {
// Huh? What did happen here? - we're trying to be on the safe side
UnlockLooper();
return;
}
fCachedMenuWindow->Hide();
fCachedMenuWindow->ChildAt(0)->RemoveChild(this); fCachedMenuWindow->ChildAt(0)->RemoveChild(this);
// we don't want to be deleted when the window is removed
fCachedMenuWindow->Quit(); fCachedMenuWindow->Quit();
fCachedMenuWindow = NULL; fCachedMenuWindow = NULL;
} }
}
BMenuItem * BMenuItem *