Mercurial > hg > octave-terminal
changeset 13528:8b116446a904
Fixed race condition.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Wed, 20 Jul 2011 23:32:19 +0200 |
parents | 3ec73e6b8cbe |
children | 8e87f3ba3beb |
files | gui/src/MainWindow.cpp gui/src/MainWindow.h gui/src/OctaveLink.cpp |
diffstat | 3 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/MainWindow.cpp +++ b/gui/src/MainWindow.cpp @@ -280,6 +280,6 @@ m_octaveMainThread->start (); m_octaveCallbackThread = new OctaveCallbackThread (this, this); - m_octaveCallbackThread->start (); + connect (m_octaveMainThread, SIGNAL(ready()), m_octaveCallbackThread, SLOT(start())); reportStatusMessage (tr ("Established link to Octave.")); }
--- a/gui/src/MainWindow.h +++ b/gui/src/MainWindow.h @@ -117,16 +117,22 @@ class OctaveMainThread:public QThread { -Q_OBJECT public: +Q_OBJECT +public: OctaveMainThread (QObject * parent):QThread (parent) { } + +signals: + void ready(); + protected: void run () { int argc = 3; const char *argv[] = { "octave", "--interactive", "--line-editing" }; octave_main (argc, (char **) argv, 1); + emit ready(); main_loop (); clean_up_and_exit (0); }
--- a/gui/src/OctaveLink.cpp +++ b/gui/src/OctaveLink.cpp @@ -132,9 +132,6 @@ int serverHistoryLength = command_history::length (); // If were behind the server, iterate through all new entries and add them to our history. - - // TODO: command_history::get_entry crashes, find out why. - /* if (clientHistoryLength < serverHistoryLength) { for (int i = clientHistoryLength; i < serverHistoryLength; i++) @@ -142,7 +139,7 @@ m_historyModel->insertRow (0); m_historyModel->setData (m_historyModel->index (0), QString (command_history::get_entry (i).c_str ())); } - }*/ + } } QStringListModel *