diff scripts/plot/closereq.m @ 7966:5747be3ac497

Implement closereq as real callback execution
author John W. Eaton <jwe@octave.org>
date Tue, 22 Jul 2008 17:23:28 -0400
parents a1dbe9d80eee
children db19494c7c2a
line wrap: on
line diff
--- a/scripts/plot/closereq.m
+++ b/scripts/plot/closereq.m
@@ -28,8 +28,12 @@
 function closereq ()
 
   if (nargin == 0)
-    cf = get (0, "currentfigure");
-    if (cf != 0)
+    cf = gcbf ();
+    if (isempty (cf))
+      warning ("closereq: calling closereq from octave prompt is not supported, use `close' instead");
+      cf = get (0, "currentfigure");
+    endif
+    if (! isempty (cf) && cf != 0)
       delete (cf);
     endif
   else