* docstring.C: add a FIXME in utf8_to_ucs4() WRT static IconvProcessor and Mac

* 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
This commit is contained in:
Abdelrazak Younes 2006-11-17 16:58:32 +00:00
parent 146631a5c7
commit 4f5432f427
2 changed files with 11 additions and 3 deletions

View 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);
}
}

View 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();