Peter Kümmel wrote:

> This fixes it, then also the static QTranslator makes no problem,
> and it would be hard to forbid all static Qt objects.

Only those that interact with QApplication could be problematic.

> Could I at least check in the translator stuff, because
> at the current state lyx will not even start?

With some modifications (see below) yes. I don't understand the translator
stuff, but it works here too, and I guess you know what you are doing.

> @@ -157,29 +160,34 @@
> 
>  bool use_gui = true;
> 
> +boost::scoped_ptr<LQApplication> auto_del_app;
> 
>  void exec(int & argc, char * argv[])
>  {
>         // Force adding of font path _before_ QApplication is initialized
>         FontLoader::initFontPath();
> 
> -       LQApplication app(argc, argv);
> +       auto_del_app.reset(new LQApplication(argc, argv));

Here you are basically reintroducing the static app variable, and therefore
the crash on exit on linux. A scoped_ptr is supposed to be equivalent to a
normal object variable concerning construction and destruction, so if that
is needed i think the old solution of Abdel is better.
What I don't understand is: Why does it work for other windows users? If
this is really necessary we need to reintroduce the #ifdef of Abdel,
because I get a crash on Linux with this patch.

>         // install translation file for Qt built-in dialogs
>         // These are only installed since Qt 3.2.x
> -       QTranslator qt_trans(0);
> -       if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
> -                         qInstallPathTranslations())) {
> +       QTranslator qt_trans;
> +       QString language_name = QString("qt_") + QLocale::system().name();
> +       language_name.truncate(5);
> +       if (qt_trans.load(language_name,
> +               QLibraryInfo::location(QLibraryInfo::TranslationsPath))
> +               )
> +       {

This indentation is not LyX style, the old one is better.

>                 qApp->installTranslator(&qt_trans);
>                 // even if the language calls for RtL, don't do that
> -               qApp->setReverseLayout(false);
> +               qApp->setLayoutDirection(Qt::LeftToRight);
>                 lyxerr[Debug::GUI]
>                         << "Successfully installed Qt translations for
>                         locale "
> -                       << QTextCodec::locale() << std::endl;
> +                       << language_name.toStdString().c_str() <<
> std::endl;

toStdString is not available here (see QT_NO_STL). And why do you use c_str?

lyxerr << fromqstr(language_name);

works.


Georg

Reply via email to