* The code to handle AS_GET_SCREEN_ID_FROM_WINDOW did not lock the desktop,

which got unnoticed since the former Desktop::ActiveScreen() never changed.
  This fixes bug #4301.
* Also fixed a possible deadlock on application crash with a kWindowScreenFeel
  window; the locking order of the Desktop's and the ServerApp's window lock was
  reversed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32578 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-21 18:08:04 +00:00
parent 67838392dc
commit 91d5822a7c

View File

@ -452,19 +452,22 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_APP_CRASHED:
// Allow the debugger to show its window: if needed, remove any
// kWindowScreenFeels from the windows of this application
if (fWindowListLock.Lock()) {
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
ServerWindow* serverWindow = fWindowList.ItemAt(i);
if (fDesktop->LockAllWindows()) {
if (fWindowListLock.Lock()) {
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
ServerWindow* serverWindow = fWindowList.ItemAt(i);
Window* window = serverWindow->Window();
if (window == NULL || window->IsOffscreenWindow())
continue;
Window* window = serverWindow->Window();
if (window == NULL || window->IsOffscreenWindow())
continue;
if (window->Feel() == kWindowScreenFeel)
fDesktop->SetWindowFeel(window, B_NORMAL_WINDOW_FEEL);
if (window->Feel() == kWindowScreenFeel)
fDesktop->SetWindowFeel(window, B_NORMAL_WINDOW_FEEL);
}
fWindowListLock.Unlock();
}
fWindowListLock.Unlock();
fDesktop->UnlockAllWindows();
}
break;
@ -2256,7 +2259,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
int32 clientToken;
if (link.Read<int32>(&clientToken) != B_OK)
status = B_BAD_DATA;
else {
else if (fDesktop->LockAllWindows()) {
BAutolock locker(fWindowListLock);
for (int32 i = fWindowList.CountItems(); i-- > 0;) {
@ -2270,7 +2273,9 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
break;
}
}
}
fDesktop->UnlockAllWindows();
} else
status = B_ERROR;
if (status != B_OK)
fLink.StartMessage(status);
@ -2894,7 +2899,7 @@ ServerApp::_CreateWindow(int32 code, BPrivate::LinkReceiver& link,
status = B_ERROR;
}
if (status < B_OK)
if (status != B_OK)
delete window;
}