[haiku-commits] r37862 - in haiku/trunk/src: apps/readonlybootprompt kits/locale

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 3 Aug 2010 10:48:34 +0200 (CEST)

Author: pulkomandy
Date: 2010-08-03 10:48:34 +0200 (Tue, 03 Aug 2010)
New Revision: 37862
Changeset: http://dev.haiku-os.org/changeset/37862

Modified:
   haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp
   haiku/trunk/src/kits/locale/Catalog.cpp
   haiku/trunk/src/kits/locale/CatalogStub.cpp
Log:
 * Allow ReadOnlyBootPrompt to change languages at runtime again.


Modified: haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp
===================================================================
--- haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp        
2010-08-03 07:35:42 UTC (rev 37861)
+++ haiku/trunk/src/apps/readonlybootprompt/BootPromptWindow.cpp        
2010-08-03 08:48:34 UTC (rev 37862)
@@ -177,13 +177,15 @@
        }
 }
 
+namespace BPrivate {
+       void ForceUnloadCatalog();
+};
 
 void
 BootPromptWindow::_InitCatalog(bool saveSettings)
 {
        // Initilialize the Locale Kit
-       // TODO : not possible with the current API !
-       // sCatalogInitOnce = false;
+       BPrivate::ForceUnloadCatalog();
 
        // Generate a settings file
        // TODO: This should not be necessary.

Modified: haiku/trunk/src/kits/locale/Catalog.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Catalog.cpp     2010-08-03 07:35:42 UTC (rev 
37861)
+++ haiku/trunk/src/kits/locale/Catalog.cpp     2010-08-03 08:48:34 UTC (rev 
37862)
@@ -100,11 +100,9 @@
 status_t
 BCatalog::SetCatalog(const char* signature, uint32 fingerprint)
 {
-       // TODO: The previous fCatalog is leaked here. (The whole chain, it
-       // looks like.) We should take care that internal members are always
-       // properly maintained.
-       // No other method should touch fCatalog directly, either (constructor 
for
-       // example)
+       // This is not thread safe. It is used only in ReadOnlyBootPrompt and 
should
+       // not do harm there, but not sure what to do about it…
+       delete fCatalog;
        fCatalog = mutable_locale_roster->LoadCatalog(signature, NULL, 
fingerprint);
 
        return B_OK;

Modified: haiku/trunk/src/kits/locale/CatalogStub.cpp
===================================================================
--- haiku/trunk/src/kits/locale/CatalogStub.cpp 2010-08-03 07:35:42 UTC (rev 
37861)
+++ haiku/trunk/src/kits/locale/CatalogStub.cpp 2010-08-03 08:48:34 UTC (rev 
37862)
@@ -24,3 +24,11 @@
        return _GetCatalog(&sCatalog, &sCatalogInitOnce);
 }
 
+
+namespace BPrivate{
+       void ForceUnloadCatalog()
+       {
+               sCatalogInitOnce = false;
+       }
+}
+


Other related posts:

  • » [haiku-commits] r37862 - in haiku/trunk/src: apps/readonlybootprompt kits/locale - pulkomandy