call RemoveSelf() on the replicant before deleting them. Fixes bug #1405

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21996 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-17 08:51:39 +00:00
parent afc8f551f8
commit 22e16ac590

View File

@ -1067,16 +1067,17 @@ BShelf::_DeleteReplicant(replicant_data* item)
int32 index = replicant_data::IndexOf(&fReplicants, item->message);
// TODO: Test if it's ok here
ReplicantDeleted(index, item->message, view);
fReplicants.RemoveItem(item);
fReplicants.RemoveItem(item);
if (loadedImage && item->image >= 0)
unload_add_on(item->image);
delete item;
// TODO: Should we also delete the view ?
return B_OK;
}
@ -1195,11 +1196,15 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
// the view has not been accepted
if (relation == BDragger::TARGET_IS_PARENT
|| relation == BDragger::TARGET_IS_SIBLING)
delete replicant;
|| relation == BDragger::TARGET_IS_SIBLING) {
replicant->RemoveSelf();
delete replicant;
}
if (relation == BDragger::TARGET_IS_CHILD
|| relation == BDragger::TARGET_IS_SIBLING)
|| relation == BDragger::TARGET_IS_SIBLING) {
dragger->RemoveSelf();
delete dragger;
}
return send_reply(data, B_ERROR, uniqueID);
}