changeset 27603:bf6b192428a0

* qt-interpreter-events.cc: Use QMutexLocker objects where possible.
author John W. Eaton <jwe@octave.org>
date Thu, 31 Oct 2019 15:08:47 -0400
parents ba317c535adb
children 9bc81bf5d8a6
files libgui/src/qt-interpreter-events.cc
diffstat 1 files changed, 3 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/qt-interpreter-events.cc	Thu Oct 31 14:43:47 2019 -0400
+++ b/libgui/src/qt-interpreter-events.cc	Thu Oct 31 15:08:47 2019 -0400
@@ -386,12 +386,10 @@
 
   void qt_interpreter_events::get_named_icon_slot (const QString& name)
   {
-    lock ();
+    QMutexLocker autolock (&m_mutex);
 
     m_result = QVariant::fromValue (resource_manager::icon (name));
 
-    unlock ();
-
     wake_all ();
   }
 
@@ -557,12 +555,10 @@
   void
   qt_interpreter_events::confirm_shutdown_octave (void)
   {
-    lock ();
+    QMutexLocker autolock (&m_mutex);
 
     m_result = m_octave_qobj.confirm_shutdown ();
 
-    unlock ();
-
     wake_all ();
   }
 
@@ -579,8 +575,7 @@
   qt_interpreter_events::gui_preference_slot (const QString& key,
                                               const QString& value)
   {
-    // Wait for worker to suspend
-    lock ();
+    QMutexLocker autolock (&m_mutex);
 
     QSettings *settings = resource_manager::get_settings ();
 
@@ -599,9 +594,6 @@
 
     m_result = read_value;
 
-    // We are done: Unlock and wake the worker thread
-    unlock ();
-
     wake_all ();
   }
 
@@ -646,6 +638,4 @@
 
     return adjusted_value;
   }
-
-  
 }