haiku/headers/os/app
Markus Himmel a1eccae96f Make sure images containing BTranslators are not unloaded early
When a translator is uninstalled, BTranslatorPrivate::_RemoveTranslators is
called. This method used to unload the image containing the translator after
calling Release() on it resulting in several problems:

- If the translator was still busy, e.g. translating something while being
  installed, it crashed since the image was unloaded even though its refcount
  was larger than 0.
- Applications using code from one of the translators (e.g. its config view)
  would crash when the translator is uninstalled (this is bug #12005).

This problem is now fixed. The roster keeps track of all translators whose
image it manages (even if the translator was already removed from the roster).
It also keeps a refcount to all images. When a translator's refcount drops to
zero and it belonged to a roster at some point, it does not delete itself, but
notifies the roster that it is ready to destruct, which then removes it from
the roster if the translator is still in it, destroys the translator, decrements
the refcount of the image and if the new refcount is zero, unloads the image.
All of this is done in a message handler, since if the translator called
TranslatorDeleted like before, the unloaded image would be referenced when
the stack is walked up.

Finally, the DataTranslations preflet is required to Acquire() the translator
whose config view it is showing, because otherwise its refcount could be reduced
to 0 and the image unloaded. BTranslatorRoster now enables users to acquire a
translator by ID. By the time the translator has to be released, it might not
be part of the roster anymore though. Since BTranslatorRoster tries not to give
out raw pointers to the translators it manages, users who acquire a translator
through a roster now are given a BTranslatorReleaseDelegate, which allows for
releasing the BTranslator exactly once and then self-destructs.

Signed-off-by: Axel Dörfler <axeld@pinc-software.de>
2015-11-13 11:26:53 +01:00
..
AppDefs.h Make sure images containing BTranslators are not unloaded early 2015-11-13 11:26:53 +01:00
Application.h The beginnings of a launch_daemon for Haiku. 2015-07-22 20:39:47 +02:00
Clipboard.h Indentation update. 2010-03-13 17:55:17 +00:00
Cursor.h * Tweaked the thumbsize of the pointing hand cursors. 2010-03-20 14:23:42 +00:00
Handler.h App Kit: style changes. 2014-06-11 16:24:02 -04:00
Invoker.h * style adjustments - no functional change 2010-08-17 16:47:14 +00:00
Key.h Make Flatten/Unflatten public and remove IsRegistered(). 2013-03-05 11:04:02 -05:00
KeyStore.h Add generic unlock key setting and removal. 2013-03-05 11:04:57 -05:00
Looper.h BLooper: don't delete a launch_daemon port. 2015-07-22 20:40:52 +02:00
Message.h BMessage: add default parameter to GetString()/GetBool(). 2015-03-27 13:21:48 +01:00
MessageFilter.h App Kit: style changes. 2014-06-11 16:24:02 -04:00
MessageQueue.h App Kit: style changes. 2014-06-11 16:24:02 -04:00
MessageRunner.h Style fixes to BMessageRunner, no functional changes intended 2015-01-16 18:00:27 -05:00
Messenger.h Style fixes to Messenger, no functional change intended 2015-01-16 16:43:33 -05:00
Notification.h Merge patch by plfiorini : 2011-11-02 14:57:43 +00:00
PropertyInfo.h * Should fix #6132, PropertyInfo.h was not self contained. 2010-06-06 09:37:46 +00:00
Roster.h launch_daemon: Fixed preregister consequences. 2015-11-11 16:04:02 +01:00