[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Nov 4 17:38:25 CET 2004


CVS commit by staikos: 

don't crash on "exit()" - make sure static destruction happens in-order


  M +5 -0      kst.cpp   1.255
  M +1 -0      kst.h   1.113
  M +7 -0      main.cpp   1.90


--- kdeextragear-2/kst/kst/kst.cpp  #1.254:1.255
@@ -84,4 +84,9 @@ static KstApp *inst = 0L;
 static const QString& defaultTag = KGlobal::staticQString("<Auto Name>");
 
+void KstApp::doubleCheckCleanup() {
+  delete ::inst;
+  ::inst = 0L;
+}
+
 KstApp* KstApp::inst() {
   return ::inst;

--- kdeextragear-2/kst/kst/kst.h  #1.112:1.113
@@ -77,4 +77,5 @@ class KstApp : public KMdiMainFrm {
 
     static KstApp* inst();
+    static void doubleCheckCleanup();
 
     void checkFontPresent(const QString& font);

--- kdeextragear-2/kst/kst/main.cpp  #1.89:1.90
@@ -288,4 +288,9 @@ static void ProcessEq(QString &eq, KstDa
 }
 
+
+static void exitHelper(void) {
+  KstApp::doubleCheckCleanup();
+}
+
 /****************************************************************/
 /*                                                              */
@@ -327,4 +332,6 @@ int main(int argc, char *argv[]) {
   KstApp::initialize();
 
+  atexit(exitHelper);
+
   if (app.isRestored()) {
     RESTORE(KstApp)





More information about the Kst mailing list