haiku/headers/os
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
..
add-ons Network: added notify settings updated method. 2015-03-27 13:25:27 +01:00
app Make sure images containing BTranslators are not unloaded early 2015-11-13 11:26:53 +01:00
arch ARM: remove annoying #warning 2014-10-26 23:40:17 +01:00
be_apps Applied slightly reworked and updated patch from ticket #1576 2011-10-29 15:38:20 +00:00
bluetooth Fix more GCC4 narrowing conversion warnings. 2013-05-03 19:42:04 +02:00
device Revert r42812. As pointed by Michael, one can use 2011-10-24 21:02:14 +00:00
drivers EntryCache: Add entry_cache_add_missing() for negative caching. 2015-08-20 21:25:56 +02:00
game Style fixes to the Game Kit, focus on docs 2014-06-11 16:44:48 -04:00
interface BView: add methods for affine translation/scaling/rotation 2015-11-10 23:34:08 +01:00
kernel system: Provide elf.h to applications 2015-11-07 11:49:53 +13:00
locale Update icu x86_64 package with namespace renaming enabled. 2015-05-10 21:52:36 +02:00
mail BMailAccountSettings: use BPathFinder. 2015-11-07 20:55:14 +01:00
media BMediaEventLooper: Rewrite ControlLoop() 2015-08-03 01:35:09 +02:00
midi B_BIG_SYNTH_FILE and B_LITTLE_SYNTH_FILE are deprecated. 2015-08-24 17:18:26 +02:00
midi2 style cleanup 2006-09-21 13:04:59 +00:00
net Implement CONNECT pass-through for HTTPS proxy 2015-11-11 01:16:38 +01:00
package Moved BJob, and JobQueue into the support kit. 2015-05-21 21:37:01 +02:00
storage find_paths_etc(): added user/system only flags. 2015-03-26 21:47:22 +00:00
support Add __clang__ to a few #ifdefs 2015-11-07 23:02:53 +01:00
translation Make sure images containing BTranslators are not unloaded early 2015-11-13 11:26:53 +01:00
AppKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
Be.h Patch by Jorma Karvonen: Add LocaleKit.h header and also add it to Be.h. Thanks! 2010-05-16 16:07:55 +00:00
BeBuild.h Added some support for GCC 5+. 2015-07-20 21:45:02 +02:00
DeviceKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
GameKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
InterfaceKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
KernelKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
LocaleKit.h Remove references to NumberFormatImpl. 2014-10-06 08:35:50 +02:00
MailKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
MediaKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
MidiKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
NetKit.h * Rewrote NetKit.h, and added the libnetapi headers. 2008-06-24 09:03:44 +00:00
NetworkKit.h Added the new headers to the NetworkKit.h all-in-one header. 2010-10-27 14:16:19 +00:00
StorageKit.h StorageKit.h still included the Alias.h header file I removed with the previous commit. 2007-07-06 12:52:01 +00:00
SupportKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00
TranslationKit.h added these master include files for better R5 compatibility when compiling 2002-10-23 13:48:14 +00:00