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.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user