BShelf not always unloading replicant add-ons properly
|Reported by:||anevilyak||Owned by:||anevilyak|
BShelf internally maintains a map of replicant signatures to an image add-on id+ref count pair. This is used in order to know the correct image to unload when the replicant is removed. However, it relies on instantiate_object() returning the appropriate image ID. This, however, does not always happen, since the latter is only returning the image ID in the case where it must locate the add-on by signature and then load it itself, if it can find the instantiation function in one of the already loaded images, then the image ID is left as -1, which results in the replicant images not being unloaded properly.
This behavior can be observed in Deskbar where add/removing a replicant, updating its on-disk add-on, and then trying to reload it results in the old replicant code still being used. Attached a patch which attempts to rectify the situation, review/comments welcome.