From eglen@pcg.wustl.edu  Thu Apr 11 19:55:01 2002
From: eglen@pcg.wustl.edu (eglen@pcg.wustl.edu)
Date: Thu, 11 Apr 2002 20:55:01 +0200 (MET DST)
Subject: [Rd] segmentation violation when closing the data entry window (PR#1453)
Message-ID: <200204111855.UAA19587@pubhealth.ku.dk>

[This is on Redhat Linux 7.1, using sawfish window manager under gnome:

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = Under development (unstable)
 major = 1
 minor = 5.0
 year = 2002
 month = 04
 day = 11
 language = R

Search Path:
 .GlobalEnv, package:ctest, Autoloads, package:base
]

If I close the data.entry() window using the Window manager, I get
SIGSEGV.  When debugging, the routine closewin() gets closed twice -
on the first time, the window closes, the second time I get the error.

This is with r-devel as of today, with "CFLAGS -g".  I edited
closewin() in dataentry.c to show me when it is called:

void closewin(void)
{
  printf("In routine closewin\n");
    XFreeGC(iodisplay, iogc);
    XDestroyWindow(iodisplay, iowindow);
    XCloseDisplay(iodisplay);
}


% bin/R
> x <- edit(data.frame())

The data frame pops up.  I just click on the Window manager close
button (not the "Quit" button):

In routine closewin
In routine closewin

Program received signal SIGSEGV, Segmentation fault.
0x08bd62d2 in ?? ()

When I step through in gdb (below), I see the data frame window
disappears after the first call to closewin; the segmentation fault
happens within the second call.


% bin/R -d gdb
(gdb) run

[R starts up]  Ctrl-c to get back to debugger:
(gdb) break closewin
Breakpoint 1 at 0x402195ff: file dataentry.c, line 1315.
(gdb) cont
Continuing.
> x <- edit(data.frame())

At this point, I click the "close" button provided by the window
manager, control returns to gdb.  If I then single-step through gdb, I
see the error in the second call to closewin (from line 313 of
dataentry.c)

Breakpoint 1, closewin () at dataentry.c:1315
1315      printf("In routine closewin\n");
(gdb) n
In routine closewin
1316        XFreeGC(iodisplay, iogc);
(gdb) 
1317        XDestroyWindow(iodisplay, iowindow);
(gdb) 
1318        XCloseDisplay(iodisplay);
(gdb) 
1319    }
(gdb) 
eventloop () at dataentry.c:1155
1155                           done = 1;
(gdb) 
1157                    break;
(gdb) 
1161    }
(gdb) 
RX11_dataentry (call=0x850b7c0, op=0x8270afc, args=0x8bd4e84, rho=0x8bcd998)
    at dataentry.c:312
312         endcontext(&cntxt);
(gdb) 
313         closewin();
(gdb) 

Breakpoint 1, closewin () at dataentry.c:1315
1315      printf("In routine closewin\n");
(gdb) 
In routine closewin
1316        XFreeGC(iodisplay, iogc);
(gdb) 

Program received signal SIGSEGV, Segmentation fault.
0x08bd750a in ?? ()





-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] segmentation violation when closing the data entry window (PR#1453)
eglen@pcg.wustl.edu