[Rd] closing View windows after multiple View(x) crashes
Ben Bolker
bolker at zoology.ufl.edu
Tue Jul 29 22:56:54 CEST 2008
That works like a charm. Thanks!
Ben Bolker
Bill Dunlap wrote:
> On Tue, 29 Jul 2008, Ben Bolker wrote:
>
>> > sessionInfo()
>> R version 2.8.0 Under development (unstable) (2008-07-07 r46046)
>> i686-pc-linux-gnu
>> ...
>> x = cbind(a=1:10,b=1:10)
>>
>> View(x)
>> View(x)
>> View(x)
>> View(x)
>>
>> then try to close the latest window by clicking on the "x"
>> (close-window) icon in the corner.
>> I can usually provoke a segmentation fault this way ...
>> Ubuntu Hardy, up to date.
>
> Does it work any better for you if you edit src/modules/X11/dataentry.c
> and add a call to Rsync(DE) after the XDestroyWindow(iodisplay, DE->iowindow)
> in closewin()?
>
> I don't get your crash, but I have to click twice on the X button
> to get the View window to close and valgrind complains about the use
> of freed memory, DE->prot in the event loop in R_ProcessX11Events()
> if(ioevent.xclient.message_type == _XA_WM_PROTOCOLS
> && ioevent.xclient.data.l[0] == DE->prot) {
> /* user clicked on `close' aka `destroy' */
> done = 1;
> }
> The trouble seems to be that this code sets done=1, causing the calls
> closewin(DE);
> free(DE);
> but without the Rsync call in closewin(), the window doesn't close
> immediately and later sends some messages to its event handler, causing
> the use of the freed DE. (I sometimes use the idiom free(DE);DE=NULL;
> instead of just free(DE) to make sure no one tries to use DE afterwards,
> but valgrind does that job better.)
>
> When I make closewin() call Rsync(DE) then I only have to click
> once on the X button to close the View window, the event loop
> doesn't get reentered, and valgrind seems happy.
>
> I'm using R on "Red Hat Enterprise Linux WS release 4 (Nahant Update 3)"
> with the Cygwin X server on a Windows XP laptop.
>
> ----------------------------------------------------------------------------
> Bill Dunlap
> Insightful Corporation
> bill at insightful dot com
>
> "All statements in this message represent the opinions of the author and do
> not necessarily reflect Insightful Corporation policy or position."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20080729/1d633b3d/attachment.bin>
More information about the R-devel
mailing list