--Boundary-00=_jmpjMtk5bGt/kGq Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, r1170981 | dfaure | 2010-09-02 12:42:10 +0100 (dj, 02 set 2010) | 4 lines Fix crash in KGlobal::locale() when using a kde dialog from a pure-Qt application (e.g. Open File in Qt Creator...) BUG: 248194 caused a regression for some programs (i tested with kpat, but people says koffice and amarok are also affected) in that i18n did not work at all. I've traced the problem to a klocale over a fake component being created for some reason before the klocale with the correct component and thus the klocale with the correct component never being set. This patch fixes the problem for me. Comments? Albert --Boundary-00=_jmpjMtk5bGt/kGq Content-Type: text/x-patch; charset="UTF-8"; name="klocale.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="klocale.patch" Index: kernel/kglobal.cpp =================================================================== --- kernel/kglobal.cpp (revision 1174986) +++ kernel/kglobal.cpp (working copy) @@ -73,7 +73,8 @@ inline KGlobalPrivate() : stringDict(0), locale(0), - charsets(0) + charsets(0), + localeIsFromFakeComponent(false) { // the umask is read here before any threads are created to avoid race conditions mode_t tmp = 0; @@ -96,6 +97,7 @@ KStringDict *stringDict; KLocale *locale; KCharsets *charsets; + bool localeIsFromFakeComponent; /** * This component may be used in applications that doesn't have a @@ -148,8 +150,11 @@ KLocale *KGlobal::locale() { PRIVATE_DATA; - if (d->locale == 0) { + if (d->locale == 0 || (d->localeIsFromFakeComponent && d->mainComponent.isValid() && d->mainComponent.config())) { + delete d->locale; + d->locale = 0; d->locale = new KLocale(mainComponent().catalogName()); + d->localeIsFromFakeComponent = !d->mainComponent.isValid(); QTextCodec::setCodecForLocale(d->locale->codecForEncoding()); mainComponent().aboutData()->translateInternalProgramName(); QCoreApplication* coreApp = QCoreApplication::instance(); --Boundary-00=_jmpjMtk5bGt/kGq--