Save to image crash fix (ticket:251)
[mussa.git] / qui / MussaWindow.cpp
index 883703fd3be49d8867128640dbad020699262bf5..242781606d1daf5ca55884b81ee0e9f2f51ac223 100644 (file)
@@ -69,13 +69,15 @@ MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) :
   manualAssistant(0)
 {
   init_resources();
+  
+  default_dir.reset(new QDir(QDir::home().absolutePath()));
+  
   setupWidgets();
   setupActions();
   setupAssistant();
   setupMainMenu();
   
   setWindowIcon(QIcon(":/icons/mussa.png"));
-  default_dir.reset(new QDir(QDir::home().absolutePath()));
 
   setCentralWidget(browser);
   // well updatePosition isn't quite right as we really just need
@@ -316,6 +318,9 @@ void MussaWindow::about()
   msg += "Version: ";
   msg += mussa_version;
   msg += "\n";
+  msg += "Qt: ";
+  msg += qVersion();
+  msg += "\n";
   msg += "OpenGL: ";
   msg += (char *)glGetString(GL_VERSION);
   msg += "\n";
@@ -324,6 +329,11 @@ void MussaWindow::about()
 
 void MussaWindow::clear()
 {
+  if (motif_editor != 0) {
+    motif_editor->hide();
+    delete motif_editor;
+  }
+  
   aligned_windows.clear();
   browser->clear();
 }
@@ -459,13 +469,11 @@ bool MussaWindow::isClearingAnalysisSafe()
 
 void MussaWindow::editMotifs()
 {
-  if (motif_editor != 0) {
-    motif_editor->hide();
-    delete motif_editor;
+  if (not motif_editor) {
+    motif_editor = new MotifEditor(analysis);
+    connect(motif_editor, SIGNAL(changedMotifs()), 
+            this, SLOT(updateAnnotations()));
   }
-  motif_editor = new MotifEditor(analysis);
-  connect(motif_editor, SIGNAL(changedMotifs()), 
-          this, SLOT(updateAnnotations()));
   motif_editor->show();
 }