diff libinterp/corefcn/graphics.cc @ 18761:868dcab453bd

Distinguish axes when checking for recursion in axes limits updates (bug #40005). * graphics.cc: change static variables "updating_aspectratios" and "updating_axis_limits" type to std::set<double> in order to store all currently updating axes. * graphics.cc (axes::properties::update_aspectratios, axes::update_axis_limits): update to use the new types and be able to distinguish what axes is being updated.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 04 May 2014 21:56:23 +0200
parents d57a83f2d73e
children 9fbb254c09e6
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Sun May 04 16:23:47 2014 -0700
+++ b/libinterp/corefcn/graphics.cc	Sun May 04 21:56:23 2014 +0200
@@ -5672,12 +5672,13 @@
     s = xmax(s, (limits(1) - limits(0)) / (pbfactor * dafactor));
 }
 
-static bool updating_aspectratios = false;
+static std::set<double> updating_aspectratios;
 
 void
 axes::properties::update_aspectratios (void)
 {
-  if (updating_aspectratios)
+  if (updating_aspectratios.find (get___myhandle__ ().value ()) !=
+      updating_aspectratios.end ())
     return;
 
   Matrix xlimits = get_xlim ().matrix_value ();
@@ -5743,7 +5744,7 @@
           unwind_protect frame;
           frame.protect_var (updating_aspectratios);
 
-          updating_aspectratios = true;
+          updating_aspectratios.insert (get___myhandle__ ().value ());
 
           dx = pba(0) *da(0);
           dy = pba(1) *da(1);
@@ -6691,13 +6692,14 @@
     }
 }
 
-static bool updating_axis_limits = false;
+static std::set<double> updating_axis_limits;
 
 void
 axes::update_axis_limits (const std::string& axis_type,
                           const graphics_handle& h)
 {
-  if (updating_axis_limits)
+  if (updating_axis_limits.find (get_handle ().value ()) != 
+      updating_axis_limits.end ())
     return;
 
   Matrix kids = Matrix (1, 1, h.value ());
@@ -6856,7 +6858,7 @@
   unwind_protect frame;
   frame.protect_var (updating_axis_limits);
 
-  updating_axis_limits = true;
+  updating_axis_limits.insert (get_handle ().value ());
 
   switch (update_type)
     {
@@ -6899,7 +6901,10 @@
 void
 axes::update_axis_limits (const std::string& axis_type)
 {
-  if (updating_axis_limits || updating_aspectratios)
+  if ((updating_axis_limits.find (get_handle ().value ()) != 
+       updating_axis_limits.end ()) ||
+      (updating_aspectratios.find (get_handle ().value ()) !=
+       updating_aspectratios.end ()))
     return;
 
   Matrix kids = xproperties.get_children ();
@@ -7015,7 +7020,7 @@
   unwind_protect frame;
   frame.protect_var (updating_axis_limits);
 
-  updating_axis_limits = true;
+  updating_axis_limits.insert (get_handle ().value ());
 
   switch (update_type)
     {