From ea0ba618c55707ae4d3621c96f9d153716104f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 7 Nov 2009 10:44:11 +0000 Subject: [PATCH] * "bitmap" can actually be NULL at that point, so calling ReleaseReference() on it unconditionally is not a good idea. This fixes bug #4904. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33935 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerWindow.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 3f7edebe12..a1abc9eb4a 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -590,7 +590,7 @@ fDesktop->LockAllWindows(); don't need a valid fCurrentView (ie. view creation). */ void -ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) +ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) { switch (code) { case AS_SHOW_WINDOW: @@ -1806,11 +1806,13 @@ fDesktop->LockSingleWindow(); resizingMode, options); // TODO: if we revert the view color overlay handling - // in View::Draw() to the R5 version, we never + // in View::Draw() to the BeOS version, we never // need to invalidate the view for overlays. - // invalidate view - but only if this is a non-overlay switch - if (bitmap == NULL || bitmap->Overlay() == NULL || !wasOverlay) { + // Invalidate view - but only if this is a non-overlay + // switch + if (bitmap == NULL || bitmap->Overlay() == NULL + || !wasOverlay) { BRegion dirty((BRect)fCurrentView->Bounds()); fWindow->InvalidateView(fCurrentView, dirty); } @@ -1820,7 +1822,8 @@ fDesktop->LockSingleWindow(); colorKey = bitmap->Overlay()->Color(); } - bitmap->ReleaseReference(); + if (bitmap != NULL) + bitmap->ReleaseReference(); } else status = B_BAD_VALUE; } @@ -3359,7 +3362,6 @@ ServerWindow::_MessageLooper() #endif } - #ifdef PROFILE_MESSAGE_LOOP bigtime_t dispatchStart = system_time(); #endif @@ -3394,7 +3396,7 @@ ServerWindow::_MessageLooper() // next message status_t status = receiver.GetNextMessage(code); - if (status < B_OK) { + if (status != B_OK) { // that shouldn't happen, it's our port printf("Someone deleted our message port!\n"); if (lockedDesktop)