Mercurial > hg > octave-terminal
changeset 14750:4812bcd524a1 gui
Fixed flooding the event queue by only an event after the last one has been processed.
* history-dockwidget.cc: Set update timer to single shot and starting timer again after an event.
* octave-link.cc: Flushing event queue before exiting.
* workspace-model.cc: Set update timer to single shot and starting timer again after an update event has been received.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Fri, 08 Jun 2012 19:13:50 +0200 |
parents | 06bd3610f76e |
children | c6135951bc18 |
files | gui/src/history-dockwidget.cc gui/src/octave-adapter/octave-link.cc gui/src/workspace-model.cc |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/history-dockwidget.cc +++ b/gui/src/history-dockwidget.cc @@ -47,6 +47,9 @@ } } + // Post a new update event in a given time. This prevents flooding the + // event queue. + _update_history_model_timer.start (); delete e; } @@ -95,7 +98,7 @@ SLOT (handle_visibility_changed (bool))); _update_history_model_timer.setInterval (200); - _update_history_model_timer.setSingleShot (false); + _update_history_model_timer.setSingleShot (true); connect (&_update_history_model_timer, SIGNAL (timeout ()),
--- a/gui/src/octave-adapter/octave-link.cc +++ b/gui/src/octave-adapter/octave-link.cc @@ -123,6 +123,12 @@ void octave_link::about_to_exit () { + _event_queue_mutex->lock (); + while (!_event_queue.empty ()) + _event_queue.pop (); + + _event_queue_mutex->unlock (); + if (_octave_event_listener) _octave_event_listener->about_to_exit (); }
--- a/gui/src/workspace-model.cc +++ b/gui/src/workspace-model.cc @@ -38,7 +38,7 @@ SLOT (request_update_workspace())); _update_workspace_model_timer.setInterval (500); - _update_workspace_model_timer.setSingleShot (false); + _update_workspace_model_timer.setSingleShot (true); _update_workspace_model_timer.start (); } @@ -95,6 +95,10 @@ reset(); emit expand_request(); } + + // Post a new event in a given time. + // This prevents flooding the event queue when no events are being processed. + _update_workspace_model_timer.start (); delete e; }