[PD-dev] netsend (and more) crash bug SOLVED (patch included)
Hans-Christoph Steiner
hans at at.or.at
Thu Nov 19 06:14:42 CET 2009
Hey Ico,
You should post this to the patch tracker once you are ready to submit
it.
.hc
On Nov 18, 2009, at 11:40 PM, Ivica Ico Bukvic wrote:
> Yay! Finally figured it out.
>
> Please disregard my netsend patch, it's basically treating symptoms
> rather than the source.
>
> It turns out that the patch I submitted before to fix canvas GOP
> toggle
> on/apply/off/apply crash has been the cause of the problem all along
> mainly because the final version had the second part nested, causing a
> lot of problems at close time.
>
> Namely, the old version is like this (prior to my patch):
>
> void canvas_destroy_editor(t_glist *x)
> {
> t_gobj *y;
> t_object *ob;
> if (x->gl_editor)
> {
> for (y = x->gl_list; y; y = y->g_next)
> if (ob = pd_checkobject(&y->g_pd))
> rtext_free(glist_findrtext(x, ob));
> editor_free(x->gl_editor, x);
> x->gl_editor = 0;
> }
> }
>
> The currently broken patched version (the one I proposed earlier) is:
>
> void canvas_destroy_editor(t_glist *x)
> {
> t_gobj *y;
> t_object *ob;
> if (x->gl_editor)
> glist_noselect(x);
> if (x->gl_editor && x->gl_list)
> {
> if (x->gl_list) {
> for (y = x->gl_list; y; y = y->g_next)
> if (ob = pd_checkobject(&y->g_pd))
> rtext_free(glist_findrtext(x, ob));
>
> //notice how this part is never reached if x->gl_list
> //condition is not satisfied, yet it is reached in
> //previous version...
> //this is the cause of
> //problems I've been experiencing
> if (x->gl_editor) {
> editor_free(x->gl_editor, x);
> x->gl_editor = 0;
> }
> }
> }
> }
>
> Sooooo, here's the correct version which still resolves two issues
> pointed out before without introducing any known regressions. The
> issues
> once again are:
>
> #1 crash when creating a new patch->create a sub-patch->open sub-patch
> properties->enable GOP->apply->disable GOP (without closing
> properties)->apply
> #2 crash when creating a new patch->create a sub-patch->create an
> object
> *and leave elected->open sub-patch properties->enable
> GOP->apply->disable GOP (without closing properties)->apply
>
> CORRECT VERSION:
>
> void canvas_destroy_editor(t_glist *x)
> {
> t_gobj *y;
> t_object *ob;
> glist_noselect(x); //necessary to resolve crash #2
> if (x->gl_editor)
> {
> if (x->gl_list) { //necessary to resolve crash #1
> for (y = x->gl_list; y; y = y->g_next)
> if (ob = pd_checkobject(&y->g_pd))
> rtext_free(glist_findrtext(x, ob));
> }
> //fix to make this condition independent from x->gl_list
> if (x->gl_editor) {
> editor_free(x->gl_editor, x);
> x->gl_editor = 0;
> }
> }
> }
>
> Cheers!
>
> ico
>
----------------------------------------------------------------------------
Information wants to be free. -Stewart Brand
More information about the Pd-dev
mailing list