octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build fails on current CVS


From: Daniel J Sebald
Subject: Re: Build fails on current CVS
Date: Tue, 20 Mar 2007 03:43:35 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

[bad patch, I'm learning...]

Daniel J Sebald wrote:
Shai Ayal wrote:

from the Changelog, __lock_globals__ seems to be obsolete.
I got this to work by deleting the reference to __lock_globals__ in drawnow.m

Oh yeah, I see that now.  Hmm.  Well, (John) is there any harm in simply
making this variable persistent?  The worst that would happen is someone
would swap out drawnow.m a few times and there'd end up a few
__go_close_all__() at exit.

In the attached patch I've also moved the atexit("__go_close_all__") to
after the validity of the plot stream is tested.  (Or is there a reason
to close plots even though they may have not been created exterior to
Octave?)

Also, is there some reason for Octave to use the "persistent" option of
gnuplot to leave windows open after the end of Octave/gnuplot
processes?  If so, then should this "__go_close_all__" be conditioned on
something?  Otherwise, not.

Dan
RCS file: /cvs/octave/scripts/plot/drawnow.m,v
retrieving revision 1.8
diff -u -r1.8 drawnow.m
--- octave/scripts/plot/drawnow.m       14 Mar 2007 16:51:29 -0000      1.8
+++ octave/scripts/plot/drawnow.m       20 Mar 2007 08:24:50 -0000
@@ -26,12 +26,8 @@
 
 function drawnow (term, file)
 
-  ## Use this instead of persistent and mlock so that drawnow can be
-  ## replaced.
-  global __go_close_all_registered__;
-  if (isempty (__go_close_all_registered__))
-    __lock_global__ ("__go_close_all_registered__");
-  endif
+  ## Set true so __go_close_all__ called only once at exit.
+  persistent __go_close_all_registered__;
 
   ## Use this instead of calling gcf to avoid creating a figure.
 
@@ -49,10 +45,6 @@
         cmd = sprintf ("%s -title \"Figure %d\"", cmd, h);
       endif
       plot_stream = popen (cmd, "w");
-      if (isempty (__go_close_all_registered__))
-       atexit ("__go_close_all__");
-       __go_close_all_registered__ = true;
-      endif
       if (plot_stream < 0)
        error ("drawnow: failed to open connection to gnuplot");
       else
@@ -60,6 +52,10 @@
        if (isunix () && isempty (getenv ("DISPLAY")))
          fprintf (plot_stream, "set terminal dumb\n;");
        endif
+       if (isempty (__go_close_all_registered__))
+         atexit ("__go_close_all__");
+         __go_close_all_registered__ = true;
+       endif
       endif
     endif
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]