Fix #7736. Avoid memory corruption
Signed-off-by: Axel Dörfler <axeld@pinc-software.de>
This commit is contained in:
parent
43ee85f69c
commit
03352b04c5
@ -347,12 +347,13 @@ ShowImageView::SetImage(const BMessage* message)
|
||||
|| message->FindRef("ref", &ref) != B_OK || bitmap == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
status_t status = SetImage(&ref, bitmap);
|
||||
BitmapOwner* bitmapOwner;
|
||||
message->FindPointer("bitmapOwner", (void**)&bitmapOwner);
|
||||
|
||||
status_t status = SetImage(&ref, bitmap, bitmapOwner);
|
||||
if (status == B_OK) {
|
||||
fFormatDescription = message->FindString("type");
|
||||
fMimeType = message->FindString("mime");
|
||||
|
||||
message->FindPointer("bitmapOwner", (void**)&fBitmapOwner);
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -360,7 +361,8 @@ ShowImageView::SetImage(const BMessage* message)
|
||||
|
||||
|
||||
status_t
|
||||
ShowImageView::SetImage(const entry_ref* ref, BBitmap* bitmap)
|
||||
ShowImageView::SetImage(const entry_ref* ref, BBitmap* bitmap,
|
||||
BitmapOwner* bitmapOwner)
|
||||
{
|
||||
// Delete the old one, and clear everything
|
||||
fUndo.Clear();
|
||||
@ -369,6 +371,7 @@ ShowImageView::SetImage(const entry_ref* ref, BBitmap* bitmap)
|
||||
_DeleteBitmap();
|
||||
|
||||
fBitmap = bitmap;
|
||||
fBitmapOwner = bitmapOwner;
|
||||
if (ref == NULL)
|
||||
fCurrentRef.device = -1;
|
||||
else
|
||||
|
@ -52,7 +52,8 @@ public:
|
||||
void SetTrackerMessenger(
|
||||
const BMessenger& trackerMessenger);
|
||||
status_t SetImage(const BMessage* message);
|
||||
status_t SetImage(const entry_ref* ref, BBitmap* bitmap);
|
||||
status_t SetImage(const entry_ref* ref, BBitmap* bitmap,
|
||||
BitmapOwner* bitmapOwner);
|
||||
const entry_ref* Image() const { return &fCurrentRef; }
|
||||
BBitmap* Bitmap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user