From e29cd74b0dfb7f67a088d69f34741eca2e1e9e8c Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Sat, 28 May 2005 17:41:24 +0000 Subject: [PATCH] Now BBitmap creates a BWindow in case it can accept views. This avoids a crash in the 'DragMe' sample app. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12870 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Bitmap.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Bitmap.cpp b/src/kits/interface/Bitmap.cpp index 64e1757ff9..758dd55b97 100644 --- a/src/kits/interface/Bitmap.cpp +++ b/src/kits/interface/Bitmap.cpp @@ -777,6 +777,7 @@ BBitmap::BBitmap(const BBitmap *source, bool acceptsViews, */ BBitmap::~BBitmap() { + delete fWindow; CleanUp(); } @@ -2291,11 +2292,17 @@ BBitmap::InitObject(BRect bounds, color_space colorSpace, uint32 flags, fToken = -1; fOrigArea = -1; } - + + fInitError = error; // TODO: on success, handle clearing to white if the flags say so. Needs to be // dependent on color space. - fInitError = error; + if (fInitError == B_OK) { + if (flags & B_BITMAP_ACCEPTS_VIEWS) { + // TODO: this probably needs to be a special kind of BWindow + fWindow = new BWindow(Bounds(), "offscreen window", B_UNTYPED_WINDOW, 0); + } + } } // CleanUp