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:
@@ -217,7 +217,10 @@ BBitmap::BBitmap(const BBitmap *source, bool acceptsViews,
|
||||
*/
|
||||
BBitmap::~BBitmap()
|
||||
{
|
||||
delete fWindow;
|
||||
if (fWindow != NULL) {
|
||||
fWindow->Lock();
|
||||
delete fWindow;
|
||||
}
|
||||
_CleanUp();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user