[PD-dev] GUI object crash on close when in subpatcher

IOhannes m zmölnig zmoelnig at iem.at
Thu Apr 9 23:08:23 CEST 2015

On 04/08/2015 05:55 AM, Rama Gottfried wrote:
> Dear list,
> I found something that seems like a bug to me, but I’m still not sure, it could be something in my code. Could someone take a look and tell me if I’m doing something incorrectly? 
> The GUI object pasted below will sometimes crash on close when in a sub-patcher, but not in a top level patcher.
> What is confusing to me is that the order of objects in the .pd file seems to make a difference.
> On my system this patch crashes on close with a Segmentation Fault: 11:

here it doesn't crash, but gives me an "error: consistency check failed:

in any case, i think you should call `canvas_deletelinesfor()`
unconditionally, even if the object is not visible.
something like:

static void basicgui_delete(t_gobj *z, t_glist *glist)
    printf("%s %p \n", __FUNCTION__, z);

    t_canvas *canvas = glist_getcanvas(glist);
    t_basicgui *x = (t_basicgui *)z;
    t_object *ob = pd_checkobject(&x->ob.te_pd);

        sys_vgui(".x%lx.c delete %lxBOX \n", glist_getcanvas(glist), z );
    if(ob && glist_isvisible(glist))
      glist_eraseiofor(glist, ob, x->io_tag);
    canvas_deletelinesfor(canvas, ob);


PS: for the future, could you *attach* your files rather than paste them
inline? it makes it so much easier to try them out.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20150409/9c37c1ae/attachment.sig>

More information about the Pd-dev mailing list