Qt4 GUI: segfault if initSimulation fails fixed

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

Qt4 GUI: segfault if initSimulation fails fixed

Post #1by refsteff » 28.09.2011, 10:20


If CelestiaCore->initSimulation fails (configfile errors, spice initialization fails, reading of star catalogs etc.), you got an error message and
celestia crashes immediately with an segmentation fault if it call functions that depends on correct initialization.
The reason is that the return value of m_appCore->initSimulation in qtappwin.cpp is not checked.

This patch fixes it:

Code: Select all

diff -urN celestia.org/src/celestia/qt/qtappwin.cpp celestia/src/celestia/qt/qtappwin.cpp
--- celestia.org/src/celestia/qt/qtappwin.cpp   2011-08-19 16:04:59.000000000 +0200
+++ celestia/src/celestia/qt/qtappwin.cpp   2011-09-28 11:39:50.512427214 +0200
@@ -225,9 +225,14 @@
-    m_appCore->initSimulation(&configFileName,
+    if(!m_appCore->initSimulation(&configFileName,
-                            progress);
+                            progress))
+    {
+        delete progress
+        exit(1);
+    }
     delete progress;
    // Enable antialiasing if requested in the config file.

I adapted this patch from the kde code.

See you

Specs: OpenSUSE 11.2 (modified), nVidia Geforce 9400 GT, Intel E7500, celestia svn 5166 Qt4

Return to “Bugs”

Who is online