diff -r e16f209ed05b libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp --- a/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp Tue Apr 09 03:37:15 2013 -0500 @@ -79,7 +79,7 @@ dup2 (fds, STDIN_FILENO); dup2 (fds, STDOUT_FILENO); - dup2 (fds, STDERR_FILENO); +// dup2 (fds, STDERR_FILENO); if(!isatty(STDIN_FILENO)) { qDebug("Error: stdin is not a tty."); @@ -89,9 +89,9 @@ qDebug("Error: stdout is not a tty."); } - if(!isatty(STDERR_FILENO)) { - qDebug("Error: stderr is not a tty."); - } +// if(!isatty(STDERR_FILENO)) { +// qDebug("Error: stderr is not a tty."); +// } } QUnixTerminalImpl::~QUnixTerminalImpl() diff -r e16f209ed05b libgui/src/main-window.cc --- a/libgui/src/main-window.cc Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/src/main-window.cc Tue Apr 09 03:37:15 2013 -0500 @@ -78,6 +78,7 @@ main_window::~main_window (void) { +fprintf (stderr, "main_window destruct 1\n"); delete _workspace_model; delete status_bar; delete command_window; @@ -91,9 +92,6 @@ // deleted before this main_window is. Otherwise, some will be // attached to a non-existent parent. - if (_octave_qt_event_listener) - delete _octave_qt_event_listener; - octave_link::connect_link (0); delete _octave_qt_link; } @@ -262,10 +260,18 @@ void main_window::prepare_to_exit (void) { +fprintf(stderr,"Need to save edited files here as well. Should be easy. Issue close to all the file_editor_tabs somehow.\n"); write_settings (); } void +main_window::exit (void) +{ +fprintf(stderr,"I'm in main_window::exit\n"); + qApp->quit (); +} + +void main_window::reset_windows () { // TODO: Implement. @@ -580,10 +586,6 @@ setStatusBar (status_bar); - _octave_qt_event_listener = new octave_qt_event_listener (); - - // FIXME -- is it possible to eliminate the event_listenter? - construct_octave_qt_link (); QDir curr_dir; @@ -595,6 +597,9 @@ { _octave_qt_link = new octave_qt_link (); + connect (_octave_qt_link, SIGNAL (octave_thread_finished ()), + this, SLOT (exit ())); + connect (_octave_qt_link, SIGNAL (set_workspace_signal (const QString&, const QStringList&, const QStringList&, @@ -651,8 +656,6 @@ _octave_qt_link->execute_interpreter (); octave_link::connect_link (_octave_qt_link); - - octave_link::register_event_listener (_octave_qt_event_listener); } void diff -r e16f209ed05b libgui/src/main-window.h --- a/libgui/src/main-window.h Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/src/main-window.h Tue Apr 09 03:37:15 2013 -0500 @@ -51,7 +51,6 @@ #include "files-dock-widget.h" #include "terminal-dock-widget.h" #include "documentation-dock-widget.h" -#include "octave-qt-event-listener.h" #include "octave-qt-link.h" /** @@ -93,6 +92,7 @@ void show_about_octave (void); void notice_settings (const QSettings *settings); void prepare_to_exit (void); + void exit (void); void reset_windows (void); void change_directory (const QString& dir); @@ -206,8 +206,6 @@ static const int current_directory_max_count = 16; QLineEdit *_current_directory_line_edit; - octave_qt_event_listener *_octave_qt_event_listener; - octave_qt_link *_octave_qt_link; // Flag for closing whole application. diff -r e16f209ed05b libgui/src/module.mk --- a/libgui/src/module.mk Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/src/module.mk Tue Apr 09 03:37:15 2013 -0500 @@ -72,7 +72,6 @@ src/moc-files-dock-widget.cc \ src/moc-history-dock-widget.cc \ src/moc-main-window.cc \ - src/moc-octave-qt-event-listener.cc \ src/moc-octave-qt-link.cc \ src/moc-settings-dialog.cc \ src/moc-terminal-dock-widget.cc \ @@ -107,7 +106,6 @@ src/main-window.h \ src/octave-gui.h \ src/octave-main-thread.h \ - src/octave-qt-event-listener.h \ src/octave-qt-link.h \ src/qtinfo/parser.h \ src/qtinfo/webinfo.h \ @@ -130,7 +128,6 @@ src/main-window.cc \ src/octave-gui.cc \ src/octave-main-thread.cc \ - src/octave-qt-event-listener.cc \ src/octave-qt-link.cc \ src/qtinfo/parser.cc \ src/qtinfo/webinfo.cc \ diff -r e16f209ed05b libgui/src/octave-qt-link.cc --- a/libgui/src/octave-qt-link.cc Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/src/octave-qt-link.cc Tue Apr 09 03:37:15 2013 -0500 @@ -37,6 +37,14 @@ octave_qt_link::octave_qt_link (void) : octave_link (), main_thread (new octave_main_thread) { + connect (main_thread, SIGNAL (finished ()), + this, SIGNAL (octave_thread_finished ())); +} + +octave_qt_link::~octave_qt_link (void) +{ +fprintf(stderr,"I added this destructor in order to be complete.\n"); + delete main_thread; } void diff -r e16f209ed05b libgui/src/octave-qt-link.h --- a/libgui/src/octave-qt-link.h Mon Apr 08 19:10:23 2013 -0400 +++ b/libgui/src/octave-qt-link.h Tue Apr 09 03:37:15 2013 -0500 @@ -51,7 +51,7 @@ octave_qt_link (void); - ~octave_qt_link (void) { } + ~octave_qt_link (void); void execute_interpreter (void); @@ -115,6 +115,8 @@ void insert_debugger_pointer_signal (const QString&, int); void delete_debugger_pointer_signal (const QString&, int); + + void octave_thread_finished (void); }; #endif diff -r e16f209ed05b libinterp/interp-core/module.mk --- a/libinterp/interp-core/module.mk Mon Apr 08 19:10:23 2013 -0400 +++ b/libinterp/interp-core/module.mk Tue Apr 09 03:37:15 2013 -0500 @@ -35,7 +35,6 @@ interp-core/mex.h \ interp-core/mexproto.h \ interp-core/mxarray.in.h \ - interp-core/octave-event-listener.h \ interp-core/oct-errno.h \ interp-core/oct-fstrm.h \ interp-core/oct-hdf5.h \ diff -r e16f209ed05b libinterp/interpfcn/octave-link.cc --- a/libinterp/interpfcn/octave-link.cc Mon Apr 08 19:10:23 2013 -0400 +++ b/libinterp/interpfcn/octave-link.cc Tue Apr 09 03:37:15 2013 -0500 @@ -55,7 +55,7 @@ octave_link *octave_link::instance = 0; octave_link::octave_link (void) - : event_listener (0), event_queue_mutex (new octave_mutex ()), + : event_queue_mutex (new octave_mutex ()), gui_event_queue (), debugging (false) { command_editor::add_event_hook (octave_readline_hook); @@ -77,12 +77,6 @@ } void -octave_link::do_register_event_listener (octave_event_listener *el) -{ - event_listener = el; -} - -void octave_link::do_generate_events (void) { } @@ -96,7 +90,7 @@ event_queue_mutex->unlock (); } - + void octave_link::do_about_to_exit (void) { @@ -106,8 +100,8 @@ event_queue_mutex->unlock (); - if (event_listener) - event_listener->about_to_exit (); +// if (event_listener) +// event_listener->about_to_exit (); } bool diff -r e16f209ed05b libinterp/interpfcn/octave-link.h --- a/libinterp/interpfcn/octave-link.h Mon Apr 08 19:10:23 2013 -0400 +++ b/libinterp/interpfcn/octave-link.h Tue Apr 09 03:37:15 2013 -0500 @@ -28,7 +28,6 @@ #include #include "event-queue.h" -#include "octave-event-listener.h" class octave_mutex; class string_vector; @@ -52,12 +51,6 @@ virtual ~octave_link (void) { } - static void register_event_listener (octave_event_listener *el) - { - if (instance_ok ()) - instance->do_register_event_listener (el); - } - static void generate_events (void) { if (instance_ok ()) @@ -90,7 +83,7 @@ if (instance_ok ()) instance->do_post_event (obj, method, arg); } - + static void about_to_exit (void) { if (instance_ok ()) @@ -214,8 +207,6 @@ protected: - octave_event_listener *event_listener; - // Semaphore to lock access to the event queue. octave_mutex *event_queue_mutex; @@ -224,8 +215,6 @@ bool debugging; - void do_register_event_listener (octave_event_listener *oel); - void do_generate_events (void); void do_process_events (void);