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
+13 -5
View File
@@ -1056,12 +1056,20 @@ BMenu::_show(bool selectFirstItem)
void
BMenu::_hide()
{
if (fCachedMenuWindow != NULL) {
fCachedMenuWindow->Lock();
fCachedMenuWindow->ChildAt(0)->RemoveChild(this);
fCachedMenuWindow->Quit();
fCachedMenuWindow = NULL;
if (!LockLooper())
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);
// we don't want to be deleted when the window is removed
fCachedMenuWindow->Quit();
fCachedMenuWindow = NULL;
}