changeset 14714:4ff6c21c18c4 gui

Solved crash on close by ignoring close event and instead executing exit in the terminal. * main-window.cc: Added invocation of 'exit' in the octave terminal. * octave-link.h: Added include of octave-event.h. * octave-event.h: Added base class for an octave event. * src.pro: Added line to track octave-event.h.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sat, 02 Jun 2012 14:44:50 +0200
parents 565ddd85565e
children b4db843b1f26
files gui/src/main-window.cc gui/src/octave-adapter/octave-event.h gui/src/octave-adapter/octave-link.h gui/src/src.pro
diffstat 4 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/main-window.cc	Sat Jun 02 13:57:51 2012 +0200
+++ b/gui/src/main-window.cc	Sat Jun 02 14:44:50 2012 +0200
@@ -215,11 +215,15 @@
 void
 main_window::closeEvent (QCloseEvent * closeEvent)
 {
+  closeEvent->ignore ();
+  _terminal->sendText ("exit\n");
+    /*
   report_status_message (tr ("Saving data and shutting down."));
   _closing = true;  // inform editor window that whole application is closed
   octave_link::instance ()->terminate_octave ();
 
   QMainWindow::closeEvent (closeEvent);
+  */
 }
 
 void
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/src/octave-adapter/octave-event.h	Sat Jun 02 14:44:50 2012 +0200
@@ -0,0 +1,39 @@
+/* OctaveGUI - A graphical user interface for Octave
+ * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef OCTAVEEVENT_H
+#define OCTAVEEVENT_H
+
+/**
+  * \class octave_event
+  * \brief Base class for an octave event.
+  */
+class octave_event
+{
+  public:
+    octave_event ()
+    {
+
+    }
+
+    virtual ~octave_event ()
+    {
+
+    }
+};
+
+#endif // OCTAVEEVENT_H
--- a/gui/src/octave-adapter/octave-link.h	Sat Jun 02 13:57:51 2012 +0200
+++ b/gui/src/octave-adapter/octave-link.h	Sat Jun 02 14:44:50 2012 +0200
@@ -75,6 +75,7 @@
 
 #include "workspace-model.h"
 #include "octave-main-thread.h"
+#include "octave-event.h"
 #include "symbol-information.h"
 
 /**
--- a/gui/src/src.pro	Sat Jun 02 13:57:51 2012 +0200
+++ b/gui/src/src.pro	Sat Jun 02 14:44:50 2012 +0200
@@ -106,7 +106,8 @@
     resource-manager.h \
     welcome-wizard.h \
     workspace-model.h \
-    terminal-dockwidget.h
+    terminal-dockwidget.h \
+    octave-adapter/octave-event.h
 
 FORMS += \
     settings-dialog.ui \