[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel] branches/kstars/summer/kstars/kstars/comast
From:       Prakash Mohan <prak902000 () gmail ! com>
Date:       2009-07-30 18:42:29
Message-ID: 1248979349.235662.30206.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1004701 by prakash:

Fixing a crash on the execute UI that occurs when the End Session is clicked before \
adding the session details.

CCMAIL: kstars-devel@kde.org


 M  +22 -18    execute.cpp  


--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1004700:1004701
@@ -46,6 +46,7 @@
     currentEyepiece = NULL;
     currentLens = NULL;
     currentFilter = NULL;
+    currentSession = NULL;
 
     //initialize the global logObject
     logObject = ks->data()->logObject();
@@ -235,26 +236,29 @@
     return true;
 }
 void Execute::slotEndSession() {
-    currentSession->setSession( ui.Id->text(), geo->fullName(), \
ui.Begin->dateTime(), KStarsDateTime::currentDateTime(), ui.Weather->toPlainText(), \
                ui.Equipment->toPlainText(), ui.Comment->toPlainText(), \
                ui.Language->text() );
-    KUrl fileURL = KFileDialog::getSaveUrl( QDir::homePath(), "*.xml" );
-    if( fileURL.isValid() ) {
-        QFile f( fileURL.path() );
-        if( ! f.open( QIODevice::WriteOnly ) ) {
-            QString message = i18n( "Could not open file %1", f.fileName() );
-            KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
-            return;
+    if( currentSession ) {
+        currentSession->setSession( ui.Id->text(), geo->fullName(), \
ui.Begin->dateTime(), KStarsDateTime::currentDateTime(), ui.Weather->toPlainText(), \
ui.Equipment->toPlainText(), ui.Comment->toPlainText(), ui.Language->text() ); +      \
KUrl fileURL = KFileDialog::getSaveUrl( QDir::homePath(), "*.xml" ); +        if( \
fileURL.isValid() ) { +            QFile f( fileURL.path() );
+            if( ! f.open( QIODevice::WriteOnly ) ) {
+                QString message = i18n( "Could not open file %1", f.fileName() );
+                KMessageBox::sorry( 0, message, i18n( "Could Not Open File" ) );
+                return;
+            }
+            QTextStream ostream( &f );
+            ostream<< logObject->writeLog( false );
+            f.close();
         }
-        QTextStream ostream( &f );
-        ostream<< logObject->writeLog( false );
-        f.close();
     }
-    ui.Id->clear();
-    hide();
-    ui.stackedWidget->setCurrentIndex(0);
-    logObject->observationList()->clear();
-    logObject->sessionList()->clear();
-    delete currentSession;
-    currentTarget = NULL;
+        ui.Id->clear();
+        hide();
+        ui.stackedWidget->setCurrentIndex(0);
+        logObject->observationList()->clear();
+        logObject->sessionList()->clear();
+        delete currentSession;
+        currentTarget = NULL;
+        currentSession = NULL;
 }
 
 void Execute::slotSetTarget( QString name ) { 
_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic