Locale Kit: do not unload catalog add-ons

Follow-up to #16670.

I have previously changed the locale kit to load all add-ons once at
start, but did not notice that it would unload them later on. This can
also create race conditions if the locale kit is used from inside
load_add_on (as is the case in translation kit add-ons for example).

Should fix the remaining problems in #16670

Change-Id: I0e22f8e146abe4fc85d8357ebe178db948fec1cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3734
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Adrien Destugues 2021-02-06 12:48:32 +01:00 committed by Adrien Destugues
parent 1403313c7f
commit 6e1e87a3c3

View File

@ -156,7 +156,6 @@ MutableLocaleRoster::CreateCatalog(const char* type, const char* signature,
BCatalogData* catalog = info->fCreateFunc(signature, language);
if (catalog != NULL) {
info->fLoadedCatalogs.AddItem(catalog);
info->UnloadIfPossible();
return catalog;
}
}
@ -234,7 +233,6 @@ MutableLocaleRoster::LoadCatalog(const entry_ref& catalogOwner,
if (catalog != NULL)
return catalog;
}
info->UnloadIfPossible();
}
return NULL;
@ -347,7 +345,6 @@ MutableLocaleRoster::LoadCatalog(const char* signature,
/*
* unloads the given catalog (or rather: catalog-chain).
* Every single catalog of the chain will be deleted automatically.
* Add-ons that have no more current catalogs are unloaded, too.
*/
status_t
MutableLocaleRoster::UnloadCatalog(BCatalogData* catalog)
@ -371,7 +368,6 @@ MutableLocaleRoster::UnloadCatalog(BCatalogData* catalog)
if (info->fLoadedCatalogs.HasItem(catalog)) {
info->fLoadedCatalogs.RemoveItem(catalog);
delete catalog;
info->UnloadIfPossible();
res = B_OK;
break;
}