comparison libinterp/corefcn/graphics.cc @ 20257: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 c66909c234e6
children 10600b2dd3c1
comparison
equal deleted inserted replaced
20256:d7b1999f0554 20257:0f1a722133f4
11043 if (! error_state && val.compare ("expose")) 11043 if (! error_state && val.compare ("expose"))
11044 do_events = false; 11044 do_events = false;
11045 else 11045 else
11046 { 11046 {
11047 error ("drawnow: invalid argument, expected 'expose' as argument"); 11047 error ("drawnow: invalid argument, expected 'expose' as argument");
11048
11049 gh_manager::unlock ();
11050
11048 return retval; 11051 return retval;
11049 } 11052 }
11050 } 11053 }
11051 11054
11052 if (do_events) 11055 if (do_events)
11076 11079
11077 if (pos_p == std::string::npos && 11080 if (pos_p == std::string::npos &&
11078 pos_c == std::string::npos) 11081 pos_c == std::string::npos)
11079 { 11082 {
11080 error ("drawnow: empty output ''"); 11083 error ("drawnow: empty output ''");
11084
11085 gh_manager::unlock ();
11081 11086
11082 return retval; 11087 return retval;
11083 } 11088 }
11084 else if (pos_c == std::string::npos) 11089 else if (pos_c == std::string::npos)
11085 { 11090 {
11086 error ("drawnow: empty pipe '|'"); 11091 error ("drawnow: empty pipe '|'");
11092
11093 gh_manager::unlock ();
11087 11094
11088 return retval; 11095 return retval;
11089 } 11096 }
11090 else if (pos_p != std::string::npos && pos_p < pos_c) 11097 else if (pos_p != std::string::npos && pos_p < pos_c)
11091 { 11098 {
11104 11111
11105 if (! (fs && fs.is_dir ())) 11112 if (! (fs && fs.is_dir ()))
11106 { 11113 {
11107 error ("drawnow: nonexistent directory '%s'", 11114 error ("drawnow: nonexistent directory '%s'",
11108 dirname.c_str ()); 11115 dirname.c_str ());
11116
11117 gh_manager::unlock ();
11109 11118
11110 return retval; 11119 return retval;
11111 } 11120 }
11112 } 11121 }
11113 } 11122 }