Skip to content
Prev 56698 / 63424 Next

[FORGED] src/modules/X11/devX11.c, can we remove "#if BUG" yet

OK, so I did the archaeology anyway....


This was the story, R-core November 29, 2001. Part of thread "X11 still segfaults". 

------------>>
.....
Gah. I've been too tired today. Why did that take me so long?

The culprit seems to be 

R_ProcessEvents((void*) NULL)

in newX11DeviceDriver

This gets called *before* this stuff at the end of Rf_addX11Device

	dd = GEcreateDevDesc(dev);
	addDevice((DevDesc*) dd);
	initDisplayList((DevDesc*) dd);

and it is that "dd" that gets called by Rf_playDisplayList. Removing
the offending line stops the segfaulting, seemingly with no ill
effects. 

I'm not really sure what the use of that line ever was; it might be
necessary to make the call somewhere later, but it appears to have
been possible to race past it before receiving any events all the
time.

I also changed a couple of spots missing dd->newDevStruct=1

Will commit in a moment.
<<------------

And the following day, in "graphics saga part III", we had

------------->>
...

I can't make it happen in 1.3.1 but...

It is probably not unrelated to the R_ProcessEvents line that
I took out, but that was definitely wrong. However, one might reenable
it if one could change this bit of code 

 	if (!(ptr_X11DeviceDriver)((DevDesc*)(dev), display, width, height, ps, gamma, 
				      colormodel, maxcubesize, canvascolor)) {
	    free(dev);
	    errorcall(gcall, "unable to start device %s", devname);
       	}
	gsetVar(install(".Device"), mkString(devname), R_NilValue);
	dd = GEcreateDevDesc(dev);
	addDevice((DevDesc*) dd);
	initDisplayList((DevDesc*) dd);


and put the if-clause last. A cursory clance through the three
functions that are being called didn't reveal anything that would rely
on having opened the device driver first. 

Paul?

(I might try it locally, but I'm not sure I should commit anything.)

<<-----------

It seems that the suggestion was never followed up on?

-pd