From 79d50639b70c8affb4ec72ac0d97a69eb4815d1e Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Thu, 8 Aug 2013 21:59:15 -0400 Subject: [PATCH] fixed 2 segfaults: one when trying to delete array that is being read/written to by a dsp process (e.g. tabwrite), and another where creating undo checkpoint when deleting array would generate bogus data that would crash pd-l2ork. Currently undoing array deletion is not supported by undo. --- pd/src/g_array.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pd/src/g_array.c b/pd/src/g_array.c index 0fb868ff6..530b360ee 100644 --- a/pd/src/g_array.c +++ b/pd/src/g_array.c @@ -417,20 +417,26 @@ extern void canvas_apply_setundo(t_canvas *x, t_gobj *y); void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, t_floatarg fflags, t_floatarg deleteit) { - canvas_apply_setundo(glist_getcanvas(x->x_glist), (t_gobj *)x); - - int flags = fflags; - int saveit = ((flags & 1) != 0); - int style = ((flags & 6) >> 1); - /*t_float stylewas = template_getfloat( - template_findbyname(x->x_scalar->sc_template), - gensym("style"), x->x_scalar->sc_vec, 1);*/ if (deleteit != 0) { + //fprintf(stderr,"deleteit\n"); + //glist_select(x->x_glist, &x->x_gobj); + //canvas_undo_add(x->x_glist, 3, "delete", canvas_undo_set_cut(x->x_glist, 2)); // 2 = UCUT_CLEAR (from g_editor.c) + //currently cannot be undo'd until we do a new kind of undo + int dspwas = canvas_suspend_dsp(); glist_delete(x->x_glist, &x->x_gobj); + canvas_resume_dsp(dspwas); } - else - { + else + { + canvas_apply_setundo(glist_getcanvas(x->x_glist), (t_gobj *)x); + + int flags = fflags; + int saveit = ((flags & 1) != 0); + int style = ((flags & 6) >> 1); + /*t_float stylewas = template_getfloat( + template_findbyname(x->x_scalar->sc_template), + gensym("style"), x->x_scalar->sc_vec, 1);*/ int size; int styleonset, styletype; t_symbol *stylearraytype; -- GitLab