changeset 20082:0f1a722133f4

Fix deadlock condition on error in drawnow() (bug #44759). * graphics.cc (Fdrawnow): When an error is encountered, use gh_manager::unlock to release lock *before* returning from function.
author Rik <rik@octave.org>
date Wed, 08 Apr 2015 08:34:25 -0700
parents d7b1999f0554
children f1b67f6e6e45
files libinterp/corefcn/graphics.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Wed Apr 08 08:19:28 2015 -0700
+++ b/libinterp/corefcn/graphics.cc	Wed Apr 08 08:34:25 2015 -0700
@@ -11045,6 +11045,9 @@
               else
                 {
                   error ("drawnow: invalid argument, expected 'expose' as argument");
+
+                  gh_manager::unlock ();
+
                   return retval;
                 }
             }
@@ -11079,12 +11082,16 @@
                     {
                       error ("drawnow: empty output ''");
 
+                      gh_manager::unlock ();
+
                       return retval;
                     }
                   else if (pos_c == std::string::npos)
                     {
                       error ("drawnow: empty pipe '|'");
 
+                      gh_manager::unlock ();
+
                       return retval;
                     }
                   else if (pos_p != std::string::npos && pos_p < pos_c)
@@ -11107,6 +11114,8 @@
                               error ("drawnow: nonexistent directory '%s'",
                                      dirname.c_str ());
 
+                              gh_manager::unlock ();
+
                               return retval;
                             }
                         }