From p.dalgaard at biostat.ku.dk  Sun Oct  8 13:05:34 2006
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: 08 Oct 2006 13:05:34 +0200
Subject: [Rd] [R] [R-pkg] New packages pmg, gWidgets, gWidgetsRGtk2
In-Reply-To: <x2k63bytcs.fsf@turmalin.kubism.ku.dk>
References: <576452c40610060739i4a2bf2ccj3763683f31608db2@mail.gmail.com>
	<971536df0610060926s34e95924y4b84c141cc9586a7@mail.gmail.com>
	<8764ewjnpi.fsf@wiener.math.csi.cuny.edu>
	<x2k63bytcs.fsf@turmalin.kubism.ku.dk>
Message-ID: <x2fydzysn5.fsf@turmalin.kubism.ku.dk>

Peter Dalgaard <p.dalgaard at biostat.ku.dk> writes:

> verzani at math.csi.cuny.edu writes:
> 
> > Finally, for some reason I'm trying to track down, under Windows, pmg
> > is crashing when a cairoDevice graphics device is being closed. This
> > affects the plotnotebook and the Lattice Explorer. I have an update to
> > gWidgetsRGtk2 that may fix it, but I haven't had a chance to fully
> > test it. It can be installed with
> 
> This appears not to be Windows-specific. I see it on Fedora Core 5
> too:
> 
> > plot(x = ashina$vas.active, y = ashina$vas.plac, type = "p",
> +     pch = 1, col = ashina$grp)
> 
>  *** caught segfault ***
> address 0xfc, cause 'memory not mapped'
> 
> Traceback:
>  1: dev.off(h$obj at device)
>  2: handler(...)
>  3: function (...) {    handler(...)    return(TRUE)}(list(obj = <S4
>  object of class "gGraphicsRGtk">, action = NULL),     <pointer:
>  0xc327a60>)
> 
> Possible actions:
> 1: abort (with core dump)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> 
> (2.4.0 Patched, upon closing the plotnotebook)

Followup:

gdb says 

#0  0x080e7910 in Rf_KillDevice (dd=0x8287fc0)
    at ../../../R/src/main/graphics.c:4814
4814        ((GEDevDesc*) dd)->dev->close(((GEDevDesc*) dd)->dev);
(gdb) p ((GEDevDesc*) dd)->dev
$1 = (NewDevDesc *) 0x0
(gdb) bt
#0  0x080e7910 in Rf_KillDevice (dd=0x8287fc0)
    at ../../../R/src/main/graphics.c:4814
#1  0x002202da in kill_cairo (dd=Variable "dd" is not available.
) at cairoDevice.c:197
#2  0x00db21d9 in g_cclosure_marshal_VOID__VOID ()
   from /usr/lib/libgobject-2.0.so.0
#3  0x00da4f8b in g_closure_invoke () from
    /usr/lib/libgobject-2.0.so.0
#4  0x00db5e3d in g_signal_override_class_closure ()
   from /usr/lib/libgobject-2.0.so.0
#5  0x00db7347 in g_signal_emit_valist () from
    /usr/lib/libgobject-2.0.so.0
#6  0x00db7509 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#7  0x010e7761 in gtk_object_destroy () from
    /usr/lib/libgtk-x11-2.0.so.0
#8  0x011bde61 in gtk_widget_hide () from /usr/lib/libgtk-x11-2.0.so.0
#9  0x00da7600 in g_object_run_dispose () from
    /usr/lib/libgobject-2.0.so.0
#10 0x010e756e in gtk_object_destroy () from
    /usr/lib/libgtk-x11-2.0.so.0
#11 0x011be045 in gtk_widget_destroy () from
    /usr/lib/libgtk-x11-2.0.so.0
#12 0x00222258 in freeCairoDesc (dd=0xc45cfd8) at cairoDevice.c:22
#13 0x0022253d in Cairo_Close (dd=0xc45cfd8) at cairoDevice.c:550
#14 0x080e78a3 in Rf_killDevice (devNum=1)
    at ../../../R/src/main/graphics.c:4826
#15 0x08121c3f in do_devoff (call=0xbbb3c2c, op=0x9c96c28,
    args=0xbbb32b8,
    env=0xbbb3d44) at ../../../R/src/main/plot.c:132
#....

I'm a bit clueless regarding gtk, but it looks like a reentrancy
issue, with a signal trying to close the device while it is already
in the process of being closed. 

(CC moved to r-devel)

        -p

-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




[Rd] [R] [R-pkg] New packages pmg, gWidgets, gWidgetsRGtk2
Peter Dalgaard