changeset 22325:fc127f0e1ccd

Fix race condition when printing with Qt toolkit (#48519 and #44463) ObjectProxy.cc: Use connect (..., Qt::BlockingQueuedConnection) graphics.cc: Remove sleep
author Andreas Weber <andy.weber.aw@gmail.com>
date Wed, 17 Aug 2016 08:02:03 +0200
parents 6d54ecbfb50a
children 71dd9d5a5ecd
files libgui/graphics/ObjectProxy.cc libinterp/corefcn/graphics.cc
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/ObjectProxy.cc	Wed Aug 17 01:08:26 2016 -0400
+++ b/libgui/graphics/ObjectProxy.cc	Wed Aug 17 08:02:03 2016 +0200
@@ -68,7 +68,8 @@
           connect (this, SIGNAL (sendRedraw (void)),
                    m_object, SLOT (slotRedraw (void)));
           connect (this, SIGNAL (sendPrint (const QString&, const QString&)),
-                   m_object, SLOT (slotPrint (const QString&, const QString&)));
+                   m_object, SLOT (slotPrint (const QString&, const QString&)),
+                   Qt::BlockingQueuedConnection);
         }
     }
 }
--- a/libinterp/corefcn/graphics.cc	Wed Aug 17 01:08:26 2016 -0400
+++ b/libinterp/corefcn/graphics.cc	Wed Aug 17 08:02:03 2016 +0200
@@ -11106,7 +11106,13 @@
 
           go.get_toolkit ().print_figure (go, term, file, debug_file);
 
-          octave_sleep (0.05); // FIXME: really needed?
+          // FIXME: In ObjectProxy.cc ObjectProxy::init
+          // we now use connect (..., Qt::BlockingQueuedConnection)
+          // which should make the sleep unnecessary.
+          // See bug #44463 and #48519
+          // Remove it and the FIXME block above after testing.
+
+          // octave_sleep (0.05);
 
           gh_manager::lock ();
         }