]> git.lyx.org Git - features.git/commitdiff
* docstring.C: add a FIXME in utf8_to_ucs4() WRT static IconvProcessor and Mac
authorAbdelrazak Younes <younes@lyx.org>
Fri, 17 Nov 2006 16:58:32 +0000 (16:58 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 17 Nov 2006 16:58:32 +0000 (16:58 +0000)
* lyx_main.C:
  - LyX::prepareExit(): avoid utf8_to_ucs4() conversion at this late stage because this can cause problem on Mac.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15955 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyx_main.C
src/support/docstring.C

index 104376cd7756d1a22687816a2fd90cb2f9e028df..389647b5626363c846b9ebc0754c1d3198d08379 100644 (file)
@@ -387,9 +387,11 @@ void LyX::prepareExit()
        lyxerr[Debug::INFO] << "Deleting tmp dir " << package().temp_dir() << endl;
 
        if (!destroyDir(package().temp_dir())) {
-               docstring const msg =
-                       bformat(_("Unable to remove the temporary directory %1$s"),
-                       from_utf8(package().temp_dir()));
+               // FIXME UNICODE: package().temp_dir() could in theory contain utf8 characters.
+               // We cannot use from_utf8() here because this involves the use of static data
+               // that may have been destroyed already on Mac systems.
+               docstring const msg = _("Unable to remove the temporary directory") + " "
+                       + package().temp_dir().c_str();
                Alert::warning(_("Unable to remove temporary directory"), msg);
        }
 }
index b3039edb5a2b7bb8b212a8b7ca8a3b6efa7fe879..b3e8a76b1eda3e502be2fa5974815c20397dfbca 100644 (file)
@@ -57,6 +57,12 @@ std::string const to_ascii(docstring const & ucs4)
 
 void utf8_to_ucs4(std::string const & utf8, docstring & ucs4)
 {
+       // FIXME (Abdel 17/11/06): static data are evil!
+       // This function cannot be used in the final exit process on Mac because
+       // static data are already destroyed at this stage.
+       // One solution would be to instantiate the utf8 to ucs4 IconvProcessor as a 
+       // singleton inside the LyX main class to ensure that it does not get 
+       // destroyed too early.
        static IconvProcessor iconv(ucs4_codeset, "UTF-8");
 
        size_t n = utf8.size();