[PD] how to destroy a toplevel widget without crashing pd

Patrice Colet colet.patrice at free.fr
Sat Jun 2 06:34:07 CEST 2012


 Hello,

I don't know if it's really the good section for asking this, but I guess there would be more chances to get an answer in here...

 I've made an external that is creating a toplevel widget without using t_widgetbehavior, this seem to work good but when I'm trying to implement
a 'destroy' message into the C code like this:



static void myToplevelWidget_free(t_myToplevelWidget *x)
{
    post( "myToplevelWidget: freeing ressources [NULL]" );

	 sys_vgui("set w .x%x\n",x );
	 sys_vgui("destroy $w\n");
}

extern "C" MYTOPLEVELWIDGET_EXTERNAL void myToplevelWidget_setup(void)
{
	
    proll_class = class_new(gensym("myToplevelWidget"),
				(t_newmethod)myToplevelWidget_new,
			    (t_method)myToplevelWidget_free,
				sizeof(t_myToplevelWidget), 0, A_GIMME, 0);

...
<snip>

}

(yes, it's C embedded in CPP for some reasons...)

pd is crashing when I delete the external, but if I send a destroy message like this:


static void myToplevelWidget_destroy(t_myToplevelWidget* x) 
{  		
	sys_vgui("set w .x%x\n",x );
	sys_vgui("destroy $w\n");
}

for deleting the widget by sending a message to the external, it's not crashing.



Any idea about what I am missing?

the project is attached if someone would like to try it out (needs to be compiled)
also I'd be glad to know if it compiles on linux and OSX...



-------------- next part --------------
A non-text attachment was scrubbed...
Name: proll-0.1.zip
Type: application/zip
Size: 16642 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120602/493b9fc3/attachment-0001.zip>


More information about the Pd-list mailing list