History log of /haiku/src/kits/translation/Translator.cpp
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>


# 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


# 2d17c340 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed spelling issue


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


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 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


# 2d17c340c7bb9d427f2930e814838e1177e74a30 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed spelling issue


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


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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