History log of /haiku/src/kits/translation/TranslatorRosterPrivate.h
Revision Date Author Comments
# be741f6e 13-Nov-2015 Axel Dörfler <axeld@pinc-software.de>

Minor cleanup of translator roster commit, updated copyright.


# a1eccae9 08-Nov-2015 Markus Himmel <markus@himmel-villmar.de>

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>


# 6f2961ff 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added awareness for running with a non-native ABI (hybrid build). In this case
we test for a respective subdirectory for any translators path added and use
that instead, if existing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30859 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd8ff8aa 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Yummy, more style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 225a60f1 12-Sep-2006 Jérôme Duval <korli@users.berlios.de>

only load user addons when not in safe mode
fixes bug #842


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18817 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 783f7f20 29-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented support for node monitoring - you can now be notified when new
translators are installed via BTranslatorRoster::StartWatching().
* Fixed GetTranslatorData() - some hooks are only optional (this puts the
JPEG, GIF, and some other translators back into the game).
* Made BTranslatorRoster::Default() thread-safe.
* Improved documentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f90e4543 27-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* More or less rewrote BTranslatorRoster - it now has a private implementation
class, and only wraps around that one.
* Translating is no longer serialized, you can translate more than one object
at a time now.
* A BTranslator that is released (ie. deleted) will no longer let its BTranslatorRoster
crash.
* Removed BTranslatorRoster::Version() - this kind of call definitely makes no
sense at all. It's still exported from the sources, though, for backwards
compatibility.
* Simplified and improved code.
* Images are now unloaded only once.
* Added new method IsTranslator() that will be used by the DataTranslations preferences
application.
* Began implementing new methods StartWatching()/StopWatching() that will notify
you if new translators are installed or old ones removed (this will also be used
by DataTranslations once it's ready).
* The private BTranslatorRoster class will now add itself to the existing BApplication,
in order to provide automatic updating of the translators if needed (not yet implemented
though).
* Not heavily tested yet, there might be some regressions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f2961ffab0af380ae03ee3be7cec0c4d6e86179 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added awareness for running with a non-native ABI (hybrid build). In this case
we test for a respective subdirectory for any translators path added and use
that instead, if existing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30859 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd8ff8aa9fd9e90df254e3a38ccbeb6c26e35199 25-May-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Yummy, more style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30856 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 225a60f1674de0f17dea02bcfa8e22c876b7b9c5 12-Sep-2006 Jérôme Duval <korli@users.berlios.de>

only load user addons when not in safe mode
fixes bug #842


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18817 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 783f7f20bda751a26ddaf65bd690676a43f8234e 29-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Implemented support for node monitoring - you can now be notified when new
translators are installed via BTranslatorRoster::StartWatching().
* Fixed GetTranslatorData() - some hooks are only optional (this puts the
JPEG, GIF, and some other translators back into the game).
* Made BTranslatorRoster::Default() thread-safe.
* Improved documentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17267 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f90e454336acede69d40a108df3a4634cfd5a984 27-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* More or less rewrote BTranslatorRoster - it now has a private implementation
class, and only wraps around that one.
* Translating is no longer serialized, you can translate more than one object
at a time now.
* A BTranslator that is released (ie. deleted) will no longer let its BTranslatorRoster
crash.
* Removed BTranslatorRoster::Version() - this kind of call definitely makes no
sense at all. It's still exported from the sources, though, for backwards
compatibility.
* Simplified and improved code.
* Images are now unloaded only once.
* Added new method IsTranslator() that will be used by the DataTranslations preferences
application.
* Began implementing new methods StartWatching()/StopWatching() that will notify
you if new translators are installed or old ones removed (this will also be used
by DataTranslations once it's ready).
* The private BTranslatorRoster class will now add itself to the existing BApplication,
in order to provide automatic updating of the translators if needed (not yet implemented
though).
* Not heavily tested yet, there might be some regressions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17247 a95241bf-73f2-0310-859d-f6bbb57e9c96