The BWindow destructor is called with the window locked, but we need to unlock to acquire the menu semaphore. Updated BBitmap to lock he window on quit too. This fixes last problem mentioned in bug 406

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18156 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-07-15 13:12:01 +00:00
parent 319b44afb8
commit 7212229343
2 changed files with 11 additions and 3 deletions
+7 -2
View File
@@ -350,18 +350,23 @@ BWindow::BWindow(BRect frame, int32 bitmapToken)
BWindow::~BWindow()
{
Lock();
if (BMenu *menu = dynamic_cast<BMenu *>(fFocus)) {
menu->QuitTracking();
}
// The BWindow is locked when the destructor is called,
// we need to unlock because the menubar thread tries
// to post a message, which will deadlock otherwise.
Unlock();
// Wait if a menu is still tracking
if (fMenuSem > 0) {
while (acquire_sem(fMenuSem) == B_INTERRUPTED)
;
}
Lock();
fTopView->RemoveSelf();
delete fTopView;