From: Bruno JOFRET Date: Fri, 28 Mar 2014 16:07:00 +0000 (+0100) Subject: Avoid handle no more valid if closing demo before end. X-Git-Tag: 5.5.0~158 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=b2a9b928632644c5b36a6034427d7139791581f8 Avoid handle no more valid if closing demo before end. Change-Id: I84e93a88fb85decd91f1a61d78e85aa37efbe139 --- diff --git a/scilab/modules/graphics/demos/lighting/color_light.dem.sce b/scilab/modules/graphics/demos/lighting/color_light.dem.sce index f513b38..d81a806 100644 --- a/scilab/modules/graphics/demos/lighting/color_light.dem.sce +++ b/scilab/modules/graphics/demos/lighting/color_light.dem.sce @@ -34,6 +34,9 @@ function demo_color_light() for j=1: num n = 700; for i=1:n + if ~is_handle_valid(l) then + break + end t = i / n; cdiff = diff0 * (1 - t) + diff1 * t; cspec = spec0 * (1 - t) + spec1 * t; @@ -42,6 +45,9 @@ function demo_color_light() l.specular_color = cspec; sleep(3); end + if ~is_handle_valid(l) then + break + end diff0 = diff1; spec0 = spec1; diff1 = rand(1, 3); diff --git a/scilab/modules/graphics/demos/lighting/rot_light.dem.sce b/scilab/modules/graphics/demos/lighting/rot_light.dem.sce index e986823..2bda5d8 100644 --- a/scilab/modules/graphics/demos/lighting/rot_light.dem.sce +++ b/scilab/modules/graphics/demos/lighting/rot_light.dem.sce @@ -23,7 +23,11 @@ function demo_rot_light() x = 2*cos(i*%pi/180); y = 2*sin(i*%pi/180); z = 2; - l.position = [x y z]; + if is_handle_valid(l) then + l.position = [x y z]; + else + break + end end // DEMO END endfunction diff --git a/scilab/modules/graphics/demos/lighting/rot_plot3d.dem.sce b/scilab/modules/graphics/demos/lighting/rot_plot3d.dem.sce index 8e6bf25..db4f8d5 100644 --- a/scilab/modules/graphics/demos/lighting/rot_plot3d.dem.sce +++ b/scilab/modules/graphics/demos/lighting/rot_plot3d.dem.sce @@ -21,7 +21,11 @@ function demo_rot_light() for i=1:360 sleep(5); - a.rotation_angles = [70 i]; + if (is_handle_valid(a)) then + a.rotation_angles = [70 i]; + else + break + end end // DEMO END endfunction