changeset 10593:26d51c6e1c4c

fixed fltk_backend bug when clicking on empty figure
author Shai Ayal <shaiay@users.sourceforge.net>
date Sat, 01 May 2010 00:05:46 +0300
parents f0a7a72c1fbf
children 4b421123fd17
files src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Apr 30 07:51:28 2010 -0400
+++ b/src/ChangeLog	Sat May 01 00:05:46 2010 +0300
@@ -1,3 +1,8 @@
+2010-04-30  Shai Ayal  <shaiay@users.sourceforge.net>
+
+	* DLD-FUNCTIONS/fltk_backend.cc (plot_window::set_axes_currentpoint):
+	check for valid object before manipulating it
+
 2010-04-27  John W. Eaton  <jwe@octave.org>
 
 	* graphics.h.in (string_array_property::string_array_property):
--- a/src/DLD-FUNCTIONS/fltk_backend.cc	Fri Apr 30 07:51:28 2010 -0400
+++ b/src/DLD-FUNCTIONS/fltk_backend.cc	Sat May 01 00:05:46 2010 +0300
@@ -464,19 +464,22 @@
 
   void set_axes_currentpoint (graphics_object ax, int px, int py)
   {
-    axes::properties& ap = 
-      dynamic_cast<axes::properties&> (ax.get_properties ());
+    if (ax)
+      {
+        axes::properties& ap = 
+          dynamic_cast<axes::properties&> (ax.get_properties ());
     
-    double xx, yy;
-    pixel2pos (ax, px, py, xx, yy);
+        double xx, yy;
+        pixel2pos (ax, px, py, xx, yy);
 
-    Matrix pos (2,3,0);
-    pos(0,0) = xx;
-    pos(1,0) = yy;
-    pos(0,1) = xx;
-    pos(1,1) = yy;
+        Matrix pos (2,3,0);
+        pos(0,0) = xx;
+        pos(1,0) = yy;
+        pos(0,1) = xx;
+        pos(1,1) = yy;
 
-    ap.set_currentpoint (pos);
+        ap.set_currentpoint (pos);
+      }
   }
 
   int key2shift (int key)