changeset 20698:a7903de9c359 stable

drawnow: add a delay to let the GUI thread lock the mutex when printing (bug #44463) * graphics.cc (Fdrawnow): add a 50 ms delay before trying to lock the mutex again after calling print_figure.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 12 Nov 2015 21:40:23 +0100
parents 950c8a092db7
children 234589c84d4a
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Mon Nov 09 22:13:52 2015 +0100
+++ b/libinterp/corefcn/graphics.cc	Thu Nov 12 21:40:23 2015 +0100
@@ -11325,11 +11325,18 @@
                             {
                               graphics_object go = gh_manager::get_object (h);
 
+                              // FIXME: when using qt toolkit the print_figure
+                              // method returns immediately and Canvas::print 
+                              // doesn't have enough time to lock the mutex 
+                              // before we lock it here again. We thus wait 
+                              // 50 ms (which may not be enough) to give it 
+                              // a chance: see
+                              // http://octave.1599824.n4.nabble.com/Printing-issues-with-Qt-toolkit-tp4673270.html
                               gh_manager::unlock ();
 
                               go.get_toolkit ().print_figure (go, term, file,
                                                               mono, debug_file);
-
+                              Fsleep (octave_value (0.05));
                               gh_manager::lock ();
                             }
                           else