diff src/graphics.h.in @ 13323:de081abd32c6

don't execute graphics handle callback functions recursively * graphics.h.in (callback_property::executing): New data member. (callback_property::callback_property): Initialize it. graphics.cc (callback_property::execute): Protect executing member variable. Avoid executing callback if we are already doing so.
author John W. Eaton <jwe@octave.org>
date Tue, 11 Oct 2011 21:55:21 -0400
parents 5ea207067ee5
children 1e12601d2697
line wrap: on
line diff
--- a/src/graphics.h.in	Tue Oct 11 18:08:44 2011 -0400
+++ b/src/graphics.h.in	Tue Oct 11 21:55:21 2011 -0400
@@ -1813,10 +1813,10 @@
 public:
   callback_property (const std::string& nm, const graphics_handle& h,
                      const octave_value& m)
-    : base_property (nm, h), callback (m) { }
+    : base_property (nm, h), callback (m), executing (false) { }
 
   callback_property (const callback_property& p)
-    : base_property (p), callback (p.callback) { }
+    : base_property (p), callback (p.callback), executing (false) { }
 
   octave_value get (void) const { return callback; }
 
@@ -1854,6 +1854,9 @@
 
 private:
   octave_value callback;
+
+  // If TRUE, we are executing this callback.
+  mutable bool executing;
 };
 
 // ---------------------------------------------------------------------