changeset 29592:d11dfe2813fa

avoid possible crash when closing variable editor sub-window * variable-editor.cc (variable_editor::edit_variable): Use old-style signal/slot connection to connect QApplication::focusChanged signal to variable_dock_widget::handle_focus_change slot.
author John W. Eaton <jwe@octave.org>
date Fri, 30 Apr 2021 16:54:24 -0400
parents 0023c109e1b0
children 250cefb729d1
files libgui/src/variable-editor.cc
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc	Sun May 02 07:28:15 2021 -0700
+++ b/libgui/src/variable-editor.cc	Fri Apr 30 16:54:24 2021 -0400
@@ -1228,8 +1228,11 @@
     page->setObjectName (name);
     m_main->addDockWidget (Qt::LeftDockWidgetArea, page);
 
-    connect (qApp, &QApplication::focusChanged,
-             page, &variable_dock_widget::handle_focus_change);
+    // The old-style signal/slot connection appears to be needed here to
+    // prevent a crash when closing a variable_dock_widget object.
+    connect (qApp, SIGNAL (focusChanged (QWidget*, QWidget*)),
+             page, SLOT (handle_focus_change (QWidget*, QWidget*)));
+
     connect (page, &variable_dock_widget::destroyed,
              this, &variable_editor::variable_destroyed);
     connect (page, &variable_dock_widget::variable_focused_signal,