Qt4 GUI: Nasty Qt4 / KDE4 bug that affects Celestia fixed

Report bugs, bug fixes and workarounds here.
Topic author
refsteff
Posts: 17
Joined: 30.07.2011
With us: 13 years 3 months

Qt4 GUI: Nasty Qt4 / KDE4 bug that affects Celestia fixed

Post #1by refsteff » 17.08.2011, 12:37

Hello everyone,

first I want to thank every developer of Celestia. It's a great program, keep on going!

Since a few weeks I'm trying the Qt4 GUI and after testing and playing around I found a nasty Qt4 / KDE4 bug that affects Celestia and
all Qt4 only programs that runs under KDE4.
If you have luck, you got only a warning message from KDE about a wrong initialization of localization (I can't remember the original message exactly).
For me and a few others, Celestia (and other Qt programs) crashes randomly with a segmentation fault if this happens.
This bug belongs to KDE4 until version 4.7.

After a long search on the net I found two fixes/workarounds:

1. Don't use the static members of QFileDialog (eg. getOpenFileName, getSaveFileName)
I don't like this because you have to write your own Open- and SaveFile dialogs.

2. Apply the following patch to the KDE4 libs and build them by yourself:

Code: Select all

diff --git a/kio/kfile/kfiledialog.cpp b/kio/kfile/kfiledialog.cpp
--- a/kio/kfile/kfiledialog.cpp
+++ b/kio/kfile/kfiledialog.cpp
@@ -1175,6 +1175,7 @@ public:
             return QFileDialog::getExistingDirectory(parent, caption, dir, options);
         }
 
+        fileModule(); // make sure i18n is initialized properly, needed for pure Qt applications
         KUrl url(KFileDialog::getExistingDirectory(KUrl(dir), parent, caption));
 
         if(url.isLocalFile())
@@ -1193,6 +1194,7 @@ public:
             return QFileDialog::getOpenFileName(parent, caption, dir, filter, selectedFilter, options);
         }
 
+        fileModule(); // make sure i18n is initialized properly, needed for pure Qt applications
         KFileDialog dlg(KUrl(dir), qt2KdeFilter(filter), parent);
 
         dlg.setOperationMode(KFileDialog::Opening);
@@ -1218,6 +1220,7 @@ public:
             return QFileDialog::getOpenFileNames(parent, caption, dir, filter, selectedFilter, options);
         }
 
+        fileModule(); // make sure i18n is initialized properly, needed for pure Qt applications
         KFileDialog dlg(KUrl(dir), qt2KdeFilter(filter), parent);
 
         dlg.setOperationMode(KFileDialog::Opening);
@@ -1243,6 +1246,7 @@ public:
             return QFileDialog::getSaveFileName(parent, caption, dir, filter, selectedFilter, options);
         }
 
+        fileModule(); // make sure i18n is initialized properly, needed for pure Qt applications
         KFileDialog dlg(KUrl(dir), qt2KdeFilter(filter), parent);
 
         dlg.setOperationMode(KFileDialog::Saving);


This fixes the bug not only for Celestia but for every Qt program that runs under KDE4.
I use the patched kdelibs for a couple of days without any site effects.
If you have the same issues like me, try it.

with best regards

(I apologize me for my bad english and hope you can understand me)
Specs: OpenSUSE 11.2 (modified), nVidia Geforce 9400 GT, Intel E7500, celestia svn 5166 Qt4

Return to “Bugs”