Mercurial > octave
changeset 27397:8132797b4a6a
use signal/slot connection in file-editor-tab for thread safety
* file-editor-tab.h, file-editor-tab.cc
(file_editor_tab::maybe_remove_next): New signal.
(file_editor_tab::handle_remove_next): New slot.
(file_editor_tab::file_editor_tab): Connect them.
(file_editor_tab::add_breakpoint_event): Use new signal to change
m_breakpoint_info across threads.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 12 Sep 2019 11:13:46 -0400 |
parents | 930c0fbc003b |
children | db22b63b9c59 |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h |
diffstat | 2 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc Wed Sep 11 18:01:40 2019 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu Sep 12 11:13:46 2019 -0400 @@ -225,6 +225,9 @@ connect (&m_file_system_watcher, SIGNAL (fileChanged (const QString&)), this, SLOT (file_has_changed (const QString&))); + connect (this, SIGNAL (maybe_remove_next (int)), + this, SLOT (handle_remove_next (int))); + QSettings *settings = resource_manager::get_settings (); if (settings) notice_settings (settings, true); @@ -1350,17 +1353,28 @@ bp_table::intmap bpmap = bptab.add_breakpoint (info.function_name, "", line_info, info.condition); - // Store some info breakpoint - if (m_breakpoint_info.remove_next && (bpmap.size() > 0)) + if (! bpmap.empty ()) { - bp_table::intmap::iterator bp_it = bpmap.begin(); - m_breakpoint_info.remove_line = bp_it->second; - m_breakpoint_info.remove_next = false; + bp_table::intmap::iterator bp_it = bpmap.begin (); + + int remove_line = bp_it->second; + + emit maybe_remove_next (remove_line); } } }); } + void file_editor_tab::handle_remove_next (int remove_line) + { + // Store some info breakpoint + if (m_breakpoint_info.remove_next) + { + m_breakpoint_info.remove_line = remove_line; + m_breakpoint_info.remove_next = false; + } + } + // This methos creates the find dialog in way that is at first suitable // for re-creating it after the toplevel of the editor has changed. // The find dialog is initially creatied, activated and shown with find ()
--- a/libgui/src/m-editor/file-editor-tab.h Wed Sep 11 18:01:40 2019 -0400 +++ b/libgui/src/m-editor/file-editor-tab.h Thu Sep 12 11:13:46 2019 -0400 @@ -192,6 +192,8 @@ void interpreter_event (const fcn_callback& fcn); void interpreter_event (const meth_callback& meth); + void maybe_remove_next (int remove_line); + // FIXME: The following is similar to "process_octave_code" // signal. However, currently that signal is connected to // something that simply focuses a window and not actually @@ -241,6 +243,8 @@ void handle_double_click (int p, int l, int modifier); void handle_lines_changed (void); + void handle_remove_next (int remove_line); + private: struct bp_info