[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuplot-info-beta
Subject:    Re: segfault in plot3d
From:       Daniel J Sebald <daniel.sebald () ieee ! org>
Date:       2009-02-19 7:48:46
Message-ID: 499D0EDE.4060106 () ieee ! org
[Download RAW message or body]

Daniel J Sebald wrote:

> I'd say though that the hunk of code as it existed (exists) wasn't as
> clean as it could have been.  For example, the addition of this line:

Ethan,

Give this patch a try.  I cleans up the loop and groups iteration earlier the way it \
is grouped inside the loop.  As for the "Fixme" question, I do think recording the \
iteration is necessary.

All demos still pass after this patch is applied.

Dan


["plot3d_cleanup_djs_19feb2009.patch" (text/x-patch)]

--- gnuplot/ChangeLog	2009-02-18 23:00:05.000000000 -0600
+++ gnuplot-mod/ChangeLog	2009-02-19 01:41:09.546278630 -0600
@@ -1,3 +1,7 @@
+2009-02-19  Daniel J Sebald  <daniel.sebald@ieee.org>
+
+	* src/plot3d.c:  Cleanup loop fixed in previous mod.
+
 2009-02-18  Ethan A Merritt  <merritt@u.washington.edu>
 
 	* src/plot3d.c:  The iteration code was getting confused by 3D plots
--- gnuplot/src/plot3d.c	2009-02-18 22:53:20.000000000 -0600
+++ gnuplot-mod/src/plot3d.c	2009-02-19 01:35:05.886352139 -0600
@@ -1315,6 +1315,7 @@
 
 		this_plot->plot_type = DATA3D;
 		this_plot->plot_style = data_style;
+		this_plot->iteration = iteration;
 
 		df_set_plot_mode(MODE_SPLOT);
 		specs = df_open(name_str, MAXDATACOLS, (struct curve_points *)this_plot);
@@ -1327,7 +1328,6 @@
 
 		/* for capture to key */
 		this_plot->token = end_token = c_token - 1;
-		this_plot->iteration = iteration; /* FIXME: Is this really needed? */
 
 		/* this_plot->token is temporary, for errors in get_3ddata() */
 
@@ -1696,8 +1696,7 @@
 		    /* pointer to the plot of the first dataset (surface) in the file */
 		int this_token = this_plot->token;
 
-		do {
-		    this_plot = *tp_3d_ptr;
+		while (1) {
 		    assert(this_plot != NULL);
 
 		    /* dont move tp_3d_ptr until we are sure we
@@ -1710,7 +1709,6 @@
 		    df_return = get_3ddata(this_plot);
 		    /* for second pass */
 		    this_plot->token = c_token;
-		    this_plot->iteration = iteration;
 
 		    if (this_plot->num_iso_read == 0)
 			this_plot->plot_type = NODATA;
@@ -1746,7 +1744,7 @@
 		    this_plot->iteration = iteration;
 		    /* Struct copy */
 		    this_plot->lp_properties = *these_props;
-		} while (df_return != DF_EOF);
+		}
 
 		df_close();
 		/*}}} */


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic