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:
Stefano Ceccherini
2008-09-10 11:34:56 +00:00
parent de2dcd9ab0
commit 40b71c1667
+10 -6
View File
@@ -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;
}