Ilya Zakharevich on Tue, 14 May 2002 19:19:33 -0400


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

Re: DYNAMIC_PLOTTING with gnuplot made easy


This patch makes the combination of builtin-X11 plotting and
gnuplot-X11 plotting workable.  There must be some bad side-effects
yet, e.g., I do not expect that gnuplot-X11 plotting will be usable
after swiching from gnuplot-X11 to builtin-X11 plotting.

In other words, this probably would not work:

  plotterm(X11)
  ...do-something
  plotterm(builtin)
  ...do-something
  plotterm(X11)
  ...do-something

Hmm, maybe it would; cannot trace all these fork()s, X callbacks, and
signal handler in my head...  ;-)

Enjoy,
Ilya

--- ./src/graph/plotX.c-pre-bug	Tue May 14 19:08:55 2002
+++ ./src/graph/plotX.c	Tue May 14 19:11:29 2002
@@ -169,6 +169,9 @@ rectdraw0(long *w, long *x, long *y, lon
 
   /* child process goes on */
   freeall();  /* PARI stack isn't needed anymore, keep rectgraph */
+  /* if gnuplot X11 plotting is active, may get SIGPIPE...  XXXX Better disable
+   * some X callback? */
+  os_signal(SIGPIPE, SIG_IGN);
   PARI_get_plot(1);
   display = XOpenDisplay(NULL);
   font_info = XLoadQueryFont(display, "9x15");
--- ./src/graph/plotport.c-pre-bug	Tue May 14 18:36:14 2002
+++ ./src/graph/plotport.c	Tue May 14 18:59:15 2002
@@ -210,6 +210,8 @@ free_graph(void)
 {
   int i;
 
+  if (!rectgraph)
+      return;
   for (i=0; i<NUMRECT; i++)
   {
     PariRect *e=rectgraph[i];
@@ -218,6 +220,7 @@ free_graph(void)
     free((void *)e);
   }
   free((void *)rectgraph);
+  rectgraph = 0;
 }
 
 static PariRect *