etable icon indicating copy to clipboard operation
etable copied to clipboard

plot may run off end of data

Open rgobbel opened this issue 3 years ago • 0 comments

If the table driving a plot shrinks, Plot2D.GenPlotXY can run off the end of the data, causing a segfault. The problematic code (that I know of) is at line 205 of xyplot.go:

199	// Use string labels for X axis if X is a string
200	xc := pl.Table.Table.Cols[xi]
201	if xc.DataType() == etensor.STRING {
202		xcs := xc.(*etensor.String)
203		vals := make([]string, pl.Table.Len())
204		for i, dx := range pl.Table.Idxs {
205			vals[i] = xcs.Values[dx]
206		}
207		plt.NominalX(vals...)
208	}

In the case that I've seen, the table had 15 entries for the first phase of a run, and was then resized to only 10 rows for the second phase. I've worked around the issue in the calling code by calling IdxView.DeleteInvalid after shrinking the data source table, but I really think there should be a check somewhere in etable itself.

rgobbel avatar Mar 19 '21 19:03 rgobbel