From ea2bcbf4af2a7ad4cd81f4da5eeb2c50a3fd72bc Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 7 Jun 2008 23:49:04 +0000 Subject: [PATCH] * Fix leaking the user and combined screen and user clipping. * Fix using fScreenAndUserClipping directly in CopyBits() that could crash when in fScreenAndUserClipping wasn't used (when there's no user clipping for example). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25856 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/View.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/servers/app/View.cpp b/src/servers/app/View.cpp index 546ca2cac4..8ff350c6dc 100644 --- a/src/servers/app/View.cpp +++ b/src/servers/app/View.cpp @@ -123,6 +123,8 @@ View::~View() if (fViewBitmap != NULL) gBitmapManager->DeleteBitmap(fViewBitmap); + delete fScreenAndUserClipping; + delete fUserClipping; delete fDrawState; // if (fWindow && this == fWindow->TopView()) @@ -1130,12 +1132,11 @@ View::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping) // copy children in the source rect and neither to copy onto // children in the destination rect... copyRegion->Set((clipping_rect)visibleSrc); - copyRegion->IntersectWith(&ScreenAndUserClipping(&windowContentClipping)); - // note that fScreenAndUserClipping is used directly from hereon - // because it is now up to date - + BRegion *screenAndUserClipping + = &ScreenAndUserClipping(&windowContentClipping); + copyRegion->IntersectWith(screenAndUserClipping); copyRegion->OffsetBy(-xOffset, -yOffset); - copyRegion->IntersectWith(fScreenAndUserClipping); + copyRegion->IntersectWith(screenAndUserClipping); // do the actual blit fWindow->CopyContents(copyRegion, xOffset, yOffset); @@ -1157,7 +1158,7 @@ View::CopyBits(IntRect src, IntRect dst, BRegion& windowContentClipping) // exclude the part that we could copy dirty->Exclude(copyRegion); - dirty->IntersectWith(fScreenAndUserClipping); + dirty->IntersectWith(screenAndUserClipping); fWindow->MarkContentDirty(*dirty); fWindow->RecycleRegion(dirty);