[haiku-commits] haiku: hrev54492 - src/kits/translation

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 5 Aug 2020 09:45:20 -0400 (EDT)

hrev54492 adds 1 changeset to branch 'master'
old head: 9027ca04e27113786c296cfeb5b923e6cebe24a3
new head: 0d1f89e1a35d2a5df2d5140bc8d81f054804205d
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=0d1f89e1a35d+%5E9027ca04e271

----------------------------------------------------------------------------

0d1f89e1a35d: TranslatorRoster: avoid a deadlock when launching BeLive
  
  If be_app is not running yet, trying to lock it may easily end up in a
  deadlock.
  
  Fixes #2105
  
  However, as a result of this, when this situation happens, the
  translator roster will not be node monitoring added/removed translators.
  This was already the case if BTranslatorRoster::Default was called
  before BApplication constructor, now it's also the case if called inside
  the BApplication constructor or from another thread before it finished
  running.
  
  Maybe BTranslatorRoster should try to register itself later on if it
  detects this. But it's acceptable to have the app not monitor
  translators, because adding and removing translators isn't a very common
  occurence and restarting the app to get it to notice them is probably
  ok.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev54492
Commit:      0d1f89e1a35d2a5df2d5140bc8d81f054804205d
URL:         https://git.haiku-os.org/haiku/commit/?id=0d1f89e1a35d
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Aug  5 13:39:19 2020 UTC

Ticket:      https://dev.haiku-os.org/ticket/2105

----------------------------------------------------------------------------

1 file changed, 2 insertions(+), 2 deletions(-)
src/kits/translation/TranslatorRoster.cpp | 4 ++--

----------------------------------------------------------------------------

diff --git a/src/kits/translation/TranslatorRoster.cpp 
b/src/kits/translation/TranslatorRoster.cpp
index 8ac563caa0..c54be30e9d 100644
--- a/src/kits/translation/TranslatorRoster.cpp
+++ b/src/kits/translation/TranslatorRoster.cpp
@@ -168,8 +168,8 @@ BTranslatorRoster::Private::Private()
                        }
        }
 
-       // we're sneaking us into the BApplication
-       if (be_app != NULL && be_app->Lock()) {
+       // we're sneaking ourselves into the BApplication, if it's running
+       if (be_app != NULL && !be_app->IsLaunching() && be_app->Lock()) {
                be_app->AddHandler(this);
                be_app->Unlock();
        }


Other related posts:

  • » [haiku-commits] haiku: hrev54492 - src/kits/translation - Adrien Destugues