diff libgui/src/dialog.h @ 24016:e327adeae7a0

hide mutex and wait condition data members in GUI objects * dialog.h, dialog.cc (class QUIWidgetCreator): Make mutex and waitcondition data members private. Provide lock, unlock, wait, and wake_all functions. Change all uses. * octave-qt-link.h, octave-qt-link.cc (class octave_qt_link): Likewise.
author John W. Eaton <jwe@octave.org>
date Wed, 06 Sep 2017 15:00:52 -0400
parents 5ecefb7425e3
children 194eb4bd202b
line wrap: on
line diff
--- a/libgui/src/dialog.h	Wed Sep 06 13:56:50 2017 -0400
+++ b/libgui/src/dialog.h	Wed Sep 06 15:00:52 2017 -0400
@@ -114,11 +114,10 @@
 
   const QString * get_dialog_path (void) { return m_path_name; }
 
-  // GUI objects cannot be accessed in the non-GUI thread.  However,
-  // signals can be sent to slots across threads with proper
-  // synchronization.  Hence, the use of QWaitCondition.
-  QMutex mutex;
-  QWaitCondition waitcondition;
+  void lock (void) { m_mutex.lock (); }
+  void wait (void) { m_waitcondition.wait (&m_mutex); }
+  void unlock (void) { m_mutex.unlock (); }
+  void wake_all (void) { m_waitcondition.wakeAll (); }
 
 signals:
 
@@ -158,6 +157,12 @@
   QIntList *m_list_index;
 
   QString *m_path_name;
+
+  // GUI objects cannot be accessed in the non-GUI thread.  However,
+  // signals can be sent to slots across threads with proper
+  // synchronization.  Hence, the use of QWaitCondition.
+  QMutex m_mutex;
+  QWaitCondition m_waitcondition;
 };
 
 extern QUIWidgetCreator uiwidget_creator;