diff src/graphics.cc @ 8266:81b124f463f9

properly update currentaxes when axes are deleted
author John W. Eaton <jwe@octave.org>
date Wed, 22 Oct 2008 14:57:51 -0400
parents 1f429086565c
children 53f35799b235
line wrap: on
line diff
--- a/src/graphics.cc	Wed Oct 22 14:04:27 2008 -0400
+++ b/src/graphics.cc	Wed Oct 22 14:57:51 2008 -0400
@@ -2026,6 +2026,32 @@
 }
 
 void
+figure::properties::remove_child (const graphics_handle& gh)
+{
+  base_properties::remove_child (gh);
+
+  if (gh == currentaxes.handle_value ())
+    {
+      graphics_handle new_currentaxes;
+
+      for (octave_idx_type i = 0; i < children.numel (); i++)
+	{
+	  graphics_handle kid = children(i);
+
+	  graphics_object go = gh_manager::get_object (kid);
+
+	  if (go.isa ("axes"))
+	    {
+	      new_currentaxes = kid;
+	      break;
+	    }
+	}
+
+      currentaxes = new_currentaxes;
+    }
+}
+
+void
 figure::properties::set_visible (const octave_value& val)
 {
   std::string s = val.string_value ();