Use dynamic_cast before calling DeleteReplicant. This fixes bug #2712. I'm not sure why, though. Also call unload_add_on() as last operation (and yes, doing just that was not sufficient to fix the bug)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27400 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -531,10 +531,12 @@ void
|
||||
BShelf::MessageReceived(BMessage *msg)
|
||||
{
|
||||
if (msg->what == kDeleteReplicant) {
|
||||
BView *replicant = NULL;
|
||||
if (msg->FindPointer("_target", (void **)&replicant) == B_OK && replicant != NULL)
|
||||
DeleteReplicant(replicant);
|
||||
|
||||
BHandler *replicant = NULL;
|
||||
if (msg->FindPointer("_target", (void **)&replicant) == B_OK) {
|
||||
BView *view = dynamic_cast<BView *>(replicant);
|
||||
if (view != NULL)
|
||||
DeleteReplicant(view);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1152,11 +1154,13 @@ BShelf::_DeleteReplicant(replicant_data* item)
|
||||
delete item->dragger;
|
||||
}
|
||||
|
||||
if (loadedImage && item->image >= 0)
|
||||
unload_add_on(item->image);
|
||||
image_id image = item->image;
|
||||
|
||||
delete item;
|
||||
|
||||
if (loadedImage && image >= 0)
|
||||
unload_add_on(image);
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user