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)
|
|| message->FindRef("ref", &ref) != B_OK || bitmap == NULL)
|
||||||
return B_ERROR;
|
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) {
|
if (status == B_OK) {
|
||||||
fFormatDescription = message->FindString("type");
|
fFormatDescription = message->FindString("type");
|
||||||
fMimeType = message->FindString("mime");
|
fMimeType = message->FindString("mime");
|
||||||
|
|
||||||
message->FindPointer("bitmapOwner", (void**)&fBitmapOwner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -360,7 +361,8 @@ ShowImageView::SetImage(const BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
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
|
// Delete the old one, and clear everything
|
||||||
fUndo.Clear();
|
fUndo.Clear();
|
||||||
@ -369,6 +371,7 @@ ShowImageView::SetImage(const entry_ref* ref, BBitmap* bitmap)
|
|||||||
_DeleteBitmap();
|
_DeleteBitmap();
|
||||||
|
|
||||||
fBitmap = bitmap;
|
fBitmap = bitmap;
|
||||||
|
fBitmapOwner = bitmapOwner;
|
||||||
if (ref == NULL)
|
if (ref == NULL)
|
||||||
fCurrentRef.device = -1;
|
fCurrentRef.device = -1;
|
||||||
else
|
else
|
||||||
|
@ -52,7 +52,8 @@ public:
|
|||||||
void SetTrackerMessenger(
|
void SetTrackerMessenger(
|
||||||
const BMessenger& trackerMessenger);
|
const BMessenger& trackerMessenger);
|
||||||
status_t SetImage(const BMessage* message);
|
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; }
|
const entry_ref* Image() const { return &fCurrentRef; }
|
||||||
BBitmap* Bitmap();
|
BBitmap* Bitmap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user