Author: axeld Date: 2009-11-07 11:44:11 +0100 (Sat, 07 Nov 2009) New Revision: 33935 Changeset: http://dev.haiku-os.org/changeset/33935/haiku Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: * "bitmap" can actually be NULL at that point, so calling ReleaseReference() on it unconditionally is not a good idea. This fixes bug #4904. Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2009-11-07 10:42:39 UTC (rev 33934) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2009-11-07 10:44:11 UTC (rev 33935) @@ -590,7 +590,7 @@ 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 @@ 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 @@ colorKey = bitmap->Overlay()->Color(); } - bitmap->ReleaseReference(); + if (bitmap != NULL) + bitmap->ReleaseReference(); } else status = B_BAD_VALUE; } @@ -3359,7 +3362,6 @@ #endif } - #ifdef PROFILE_MESSAGE_LOOP bigtime_t dispatchStart = system_time(); #endif @@ -3394,7 +3396,7 @@ // 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)