# HG changeset patch # User Jacob Dawid # Date 1338641090 -7200 # Node ID 4ff6c21c18c43f85a7fcd0580a9f37253b57dbb4 # Parent 565ddd85565e39a979805eff1d269a779c458f5b 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. diff --git a/gui/src/main-window.cc b/gui/src/main-window.cc --- a/gui/src/main-window.cc +++ b/gui/src/main-window.cc @@ -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 diff --git a/gui/src/octave-adapter/octave-event.h b/gui/src/octave-adapter/octave-event.h new file mode 100644 --- /dev/null +++ b/gui/src/octave-adapter/octave-event.h @@ -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 . + */ + +#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 diff --git a/gui/src/octave-adapter/octave-link.h b/gui/src/octave-adapter/octave-link.h --- a/gui/src/octave-adapter/octave-link.h +++ b/gui/src/octave-adapter/octave-link.h @@ -75,6 +75,7 @@ #include "workspace-model.h" #include "octave-main-thread.h" +#include "octave-event.h" #include "symbol-information.h" /** diff --git a/gui/src/src.pro b/gui/src/src.pro --- a/gui/src/src.pro +++ b/gui/src/src.pro @@ -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 \