* "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
This commit is contained in:
Axel Dörfler
2009-11-07 10:44:11 +00:00
parent ebcdd1fc61
commit ea0ba618c5
+9 -7
View File
@@ -590,7 +590,7 @@ fDesktop->LockAllWindows();
don't need a valid fCurrentView (ie. view creation). don't need a valid fCurrentView (ie. view creation).
*/ */
void void
ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
{ {
switch (code) { switch (code) {
case AS_SHOW_WINDOW: case AS_SHOW_WINDOW:
@@ -1806,11 +1806,13 @@ fDesktop->LockSingleWindow();
resizingMode, options); resizingMode, options);
// TODO: if we revert the view color overlay handling // 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. // need to invalidate the view for overlays.
// invalidate view - but only if this is a non-overlay switch // Invalidate view - but only if this is a non-overlay
if (bitmap == NULL || bitmap->Overlay() == NULL || !wasOverlay) { // switch
if (bitmap == NULL || bitmap->Overlay() == NULL
|| !wasOverlay) {
BRegion dirty((BRect)fCurrentView->Bounds()); BRegion dirty((BRect)fCurrentView->Bounds());
fWindow->InvalidateView(fCurrentView, dirty); fWindow->InvalidateView(fCurrentView, dirty);
} }
@@ -1820,7 +1822,8 @@ fDesktop->LockSingleWindow();
colorKey = bitmap->Overlay()->Color(); colorKey = bitmap->Overlay()->Color();
} }
bitmap->ReleaseReference(); if (bitmap != NULL)
bitmap->ReleaseReference();
} else } else
status = B_BAD_VALUE; status = B_BAD_VALUE;
} }
@@ -3359,7 +3362,6 @@ ServerWindow::_MessageLooper()
#endif #endif
} }
#ifdef PROFILE_MESSAGE_LOOP #ifdef PROFILE_MESSAGE_LOOP
bigtime_t dispatchStart = system_time(); bigtime_t dispatchStart = system_time();
#endif #endif
@@ -3394,7 +3396,7 @@ ServerWindow::_MessageLooper()
// next message // next message
status_t status = receiver.GetNextMessage(code); status_t status = receiver.GetNextMessage(code);
if (status < B_OK) { if (status != B_OK) {
// that shouldn't happen, it's our port // that shouldn't happen, it's our port
printf("Someone deleted our message port!\n"); printf("Someone deleted our message port!\n");
if (lockedDesktop) if (lockedDesktop)