Mysterious Xserver crash with fl_set_xyplot_data

Martin Bartlett (martin@nitram.demon.co.uk)
Sat, 8 Mar 1997 00:09:46 +0000 (GMT)

To subscribers of the xforms list from Martin Bartlett <martin@nitram.demon.co.uk> :

I am having a problem with fl_set_xyplot_data. In a certain algorithm,
using it will cause a subsequent fl_do_forms to bring down the Xserver
without any warning or message or indication of what went wrong. I have,
since first encountering this problem, managed to build a very simple
re-creation using the xforms/DEMOS/xyplotall.c source as a basis.

What you do is change all calls to fl_set_xyplot_data to calls to
set_xyplot_data, and then you add the set_xyplot_data function
(shown below) to the bottom of the source code.

Then compile and run. It may take two or three runs to crash (last try
took three times for me - but it did it in the end).

The particular set-up I am using is:

Thinkpad 760ED (with and without DOCK II and external monitor -
happens in all configs)
Linux 2.0.28 (redhat 4.0 + patches)
Accelerated X (courtesy of Caldera)
fvwm2-95
xforms 0.84

Any of which may be contributing to the problem.

Note - this does not happen (at least I don't THINK it does) with version
0.81. And it does not happen if you comment out the call to
fl_set_xyplot_data in the set_xyplot_data function, leaving everything
else active. This leads to the suspicion that fl_set_xyplot_data in 0.84
is to blame - but Dr Zhao has had a good look at his and my code and can't
see anything wrong.

I would really appreciate some adventurous souls trying to break their own
0.81 and 0.84 set-ups with this code so that I can get an idea of what the
heck is going on!

Thanks

ps. if you want to know why this is so important, the set_xyplot_data
function is similar to the way that Xforms4Perl interfaces with xforms.
The next version is on hold till I can get this working!

-------------------------------------------------------------------------------

int
set_xyplot_data(FL_OBJECT * object,
float *x,
float *y,
int numpts,
char *str1,
char *str2,
char *str3)
{
float *xfloat, *yfloat;
int i;

xfloat = (float *)calloc(2*numpts, sizeof(float));
if (xfloat == NULL) {
printf("Failed to get xyplot point storage\n");
exit(1);
}
yfloat = xfloat + numpts;

for (i=0; i<numpts; ++i) {

xfloat[i] = x[(i)];
yfloat[i] = y[(i)];
}
fl_set_xyplot_data(object,xfloat,yfloat,numpts,
(const char *)str1,
(const char *)str2,
(const char *)str3);

/* Ok, we're done, lose the area and return an empty list*/
free((void*)xfloat);

return 0;
}

===========================================================
_/ _/_/_/_/
_/_/ _/_/ _/
_/ _/ _/ _/ _/
_/ _/_/ _/_/_/_/ Martin John Bartlett
_/ _/ _/ _/ (martin@nitram.demon.co.uk)
_/ _/ _/
_/ _/_/_/_/
_/
_/ _/
_/ _/
_/_/_/
===========================================================

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/