History log of /haiku/headers/os/translation/TranslatorRoster.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>


# d7571ebc 27-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Rewrote headers as needed.
* Cleaned up our own headers.
* Moved translator errors into Errors.h.
* Removed extra TranslationKit.h.


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


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

Style cleanup.


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


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

The 'extern "C"' was missing for the C function replacement of the Version()
method. Rather reintroduced the method (private) instead.


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


# f6e4cbb9 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


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


# b0bc48fb 19-May-2006 Axel Dörfler <axeld@pinc-software.de>

Some more GCC 4 and PPC fixes.
* Mesa doesn't compile yet, as some PPC specific stuff seems to be
missing, Philippe?
* Cortex and some other stuff has been marked x86-only, although
it's more of a "GCC 2.95.3"-only.
* I'm not sure if it's a bug in GCC 4, or if that's what the C
standard demands, but sizeof(some_type::some_field) is not
valid anymore :-/


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


# 1adf927f 12-Feb-2005 Matthew Wilber <mwilber@nowhere.fake>

Moved FuncTranslator.h to private headers since it is not intended for the user.


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


# a689e076 24-Oct-2004 Matthew Wilber <mwilber@nowhere.fake>

"Fixed" BTranslatorRoster so that it no longer stores the list of translators backwards. This is the order that applications assume, so this must be done to prevent inconsistent behavior between the R5 translation kit and the Haiku version.


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


# b0837927 11-Jan-2003 Matthew Wilber <mwilber@nowhere.fake>

changed to reflect the name change of R4xTranslator.h to FuncTranslator.h


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


# 8da2aed8 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed a spelling issue


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


# d7571ebcf7b31d7fa5d55a500910ee288a22bd00 27-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Rewrote headers as needed.
* Cleaned up our own headers.
* Moved translator errors into Errors.h.
* Removed extra TranslationKit.h.


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


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

Style cleanup.


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


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

The 'extern "C"' was missing for the C function replacement of the Version()
method. Rather reintroduced the method (private) instead.


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


# f6e4cbb95290a74b33d012600438b84742b0e572 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


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


# b0bc48fbd360f10cee1856e03393c63dcbdd180f 19-May-2006 Axel Dörfler <axeld@pinc-software.de>

Some more GCC 4 and PPC fixes.
* Mesa doesn't compile yet, as some PPC specific stuff seems to be
missing, Philippe?
* Cortex and some other stuff has been marked x86-only, although
it's more of a "GCC 2.95.3"-only.
* I'm not sure if it's a bug in GCC 4, or if that's what the C
standard demands, but sizeof(some_type::some_field) is not
valid anymore :-/


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


# 1adf927f76a621a6e3b9626bb94b2fe2585cf5ea 12-Feb-2005 Matthew Wilber <mwilber@nowhere.fake>

Moved FuncTranslator.h to private headers since it is not intended for the user.


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


# a689e076c376b803c55a6f5ba17c62fe56daa5cb 24-Oct-2004 Matthew Wilber <mwilber@nowhere.fake>

"Fixed" BTranslatorRoster so that it no longer stores the list of translators backwards. This is the order that applications assume, so this must be done to prevent inconsistent behavior between the R5 translation kit and the Haiku version.


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


# b0837927f692e64b8c2dcc44bb415e1f53ca85bd 11-Jan-2003 Matthew Wilber <mwilber@nowhere.fake>

changed to reflect the name change of R4xTranslator.h to FuncTranslator.h


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


# 8da2aed83101767678a288a9ac2e8f04beb5bf4b 17-Oct-2002 Matthew Wilber <mwilber@nowhere.fake>

fixed a spelling issue


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