Mercurial > octave
changeset 29000:8a05763823d1 stable
avoid possible infinite loop when default encoding is changed (bug #59331)
* main-window.h, main-window.cc (main_window::notice_settings):
New argument, UPDATE_BY_WORKER. If true, don't call
update_default_encoding.
(main_window::construct): Update settings_changed/notice_settings
signal/slot connection.
* qt-interpreter-events.h, qt-interpreter-events.cc
(qt_interpreter_events::settings_changed): Update signature of signal
to include bool parameter.
(qt_interpreter_events::gui_preference_slot): Emit settings_changed
with bool parameter set to TRUE.
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Tue, 27 Oct 2020 22:28:44 +0100 |
parents | b3cd6eb1cca5 |
children | 77494c7a9fbc 6075738dc529 |
files | libgui/src/main-window.cc libgui/src/main-window.h libgui/src/qt-interpreter-events.cc libgui/src/qt-interpreter-events.h |
diffstat | 4 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Wed Oct 28 15:23:30 2020 +0900 +++ b/libgui/src/main-window.cc Tue Oct 27 22:28:44 2020 +0100 @@ -838,7 +838,8 @@ QString::fromStdString (message)); } - void main_window::notice_settings (const gui_settings *settings) + void main_window::notice_settings (const gui_settings *settings, + bool update_by_worker) { if (! settings) return; @@ -927,7 +928,9 @@ // Check whether some octave internal preferences have to be updated QString new_default_encoding = settings->value (ed_default_enc).toString (); - if (new_default_encoding != m_default_encoding) + // Do not update internal pref only if a) this update was not initiated + // by the worker and b) the pref has really changes + if (! update_by_worker && (new_default_encoding != m_default_encoding)) update_default_encoding (new_default_encoding); // Set cursor blinking depending on the settings @@ -2169,8 +2172,8 @@ qt_interpreter_events *qt_link = interp_qobj->qt_link (); - connect (qt_link, SIGNAL (settings_changed (const gui_settings *)), - this, SLOT (notice_settings (const gui_settings *))); + connect (qt_link, SIGNAL (settings_changed (const gui_settings *, bool)), + this, SLOT (notice_settings (const gui_settings *, bool))); connect (qt_link, SIGNAL (apply_new_settings (void)), this, SLOT (request_reload_settings (void)));
--- a/libgui/src/main-window.h Wed Oct 28 15:23:30 2020 +0900 +++ b/libgui/src/main-window.h Tue Oct 27 22:28:44 2020 +0100 @@ -157,7 +157,8 @@ = QString ()); void show_about_octave (void); - void notice_settings (const gui_settings *settings); + void notice_settings (const gui_settings *settings, + bool update_by_worker = false); void prepare_to_exit (void); void go_to_previous_widget (void); void reset_windows (void);
--- a/libgui/src/qt-interpreter-events.cc Wed Oct 28 15:23:30 2020 +0900 +++ b/libgui/src/qt-interpreter-events.cc Tue Oct 27 22:28:44 2020 +0100 @@ -601,7 +601,7 @@ // Change settings only for new, non-empty values settings->setValue (key, QVariant (adjusted_value)); - emit settings_changed (settings); + emit settings_changed (settings, true); // true: changed by worker } m_result = read_value;
--- a/libgui/src/qt-interpreter-events.h Wed Oct 28 15:23:30 2020 +0900 +++ b/libgui/src/qt-interpreter-events.h Tue Oct 27 22:28:44 2020 +0100 @@ -248,7 +248,7 @@ void get_named_icon_signal (const QString& name); - void settings_changed (const gui_settings *); + void settings_changed (const gui_settings *, bool); void apply_new_settings (void);