comparison src/graphics.cc @ 12347:f6763ab98609

Prevent race condition in update_axes_layout
author Konstantinos Poulios <logari81@googlemail.com>
date Sun, 06 Feb 2011 02:24:28 +0100
parents 63dc132a1000
children d1e48a4a9a0b
comparison
equal deleted inserted replaced
12346:e1da28034c73 12347:f6763ab98609
3897 zd/(zlimits(1)-zlimits(0))); 3897 zd/(zlimits(1)-zlimits(0)));
3898 translate (x_gl_mat1, -xo, -yo, -zo); 3898 translate (x_gl_mat1, -xo, -yo, -zo);
3899 x_gl_mat2 = x_viewport * x_projection; 3899 x_gl_mat2 = x_viewport * x_projection;
3900 } 3900 }
3901 3901
3902 static bool updating_axes_layout = false;
3903
3902 void 3904 void
3903 axes::properties::update_axes_layout (void) 3905 axes::properties::update_axes_layout (void)
3904 { 3906 {
3907 if (updating_axes_layout)
3908 return;
3909
3905 graphics_xform xform = get_transform (); 3910 graphics_xform xform = get_transform ();
3906 3911
3907 double xd = (xdir_is ("normal") ? 1 : -1); 3912 double xd = (xdir_is ("normal") ? 1 : -1);
3908 double yd = (ydir_is ("normal") ? 1 : -1); 3913 double yd = (ydir_is ("normal") ? 1 : -1);
3909 double zd = (zdir_is ("normal") ? 1 : -1); 3914 double zd = (zdir_is ("normal") ? 1 : -1);
3988 zPlane = (dir(1) < 0 ? z_min : z_max); 3993 zPlane = (dir(1) < 0 ? z_min : z_max);
3989 else 3994 else
3990 zPlane = (dir(2) < 0 ? z_min : z_max); 3995 zPlane = (dir(2) < 0 ? z_min : z_max);
3991 zPlaneN = (zPlane == z_min ? z_max : z_min); 3996 zPlaneN = (zPlane == z_min ? z_max : z_min);
3992 fz = (z_max-z_min)/sqrt(dir(0)*dir(0)+dir(1)*dir(1)); 3997 fz = (z_max-z_min)/sqrt(dir(0)*dir(0)+dir(1)*dir(1));
3998
3999 unwind_protect frame;
4000 frame.protect_var (updating_axes_layout);
4001 updating_axes_layout = true;
3993 4002
3994 update_ticklengths (); 4003 update_ticklengths ();
3995 4004
3996 xySym = (xd*yd*(xPlane-xPlaneN)*(yPlane-yPlaneN) > 0); 4005 xySym = (xd*yd*(xPlane-xPlaneN)*(yPlane-yPlaneN) > 0);
3997 zSign = (zd*(zPlane-zPlaneN) <= 0); 4006 zSign = (zd*(zPlane-zPlaneN) <= 0);