Commit 93222ce1 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

Fixed segfault regression

* Segfault occurred when user would modify a barline array graph (for instance) and dragged the mouse outside its bounds and let go of the mouse button. This was because array issues glist_grab without e_grab being declared.

* At the same time, array also relies on letting go of the grab once the mouse is let go, so we also need to do this in the mouseup function. Otherwise, one would be stuck dragging array even after letting go of the array.
parent a70e31a3
Pipeline #2976 failed with stage
in 214 minutes and 7 seconds
......@@ -5362,24 +5362,31 @@ void canvas_mouseup(t_canvas *x,
x->gl_editor->e_onmotion = MA_NONE;
}
//fprintf(stderr,"canvas_mouseup -> canvas_doclick %d\n", which);
/* this is to ignore scrollbar clicks from within tcl and is
unused within nw.js 2.x implementation and onward. here,
we use doit = -1 to signify mouseup */
//if (canvas_last_glist_mod == -1) {
if (x->gl_editor->e_onmotion == MA_PASSOUT)
{
// here we borrow the double-click flag and make it -1 which signifies
// mouse up since otherwise doit (the last argument) value of 0 is
// shared between mouse up and mouse motion, making this unclear
if (x->gl_editor->e_grab)
{
int clickreturned = gobj_click(
x->gl_editor->e_grab, x, xpos, ypos, glob_shift, glob_alt, -1, 0);
}
// however, in the case of an array which does not have an e_grab declared
// we have to let go of the glist_grab instead
else
glist_grab(x, 0, 0, 0, 0, 0, 0, 0);
x->gl_editor->e_onmotion = MA_NONE;
}
canvas_doclick(x, xpos, ypos, 0,
(glob_shift + glob_ctrl*2 + glob_alt*4), 0);
//}
//fprintf(stderr,"canvas_mouseup -> canvas_doclick %d\n", which);
/* this is to ignore scrollbar clicks from within tcl and is
unused within nw.js 2.x implementation and onward. since
canvas_last_glist_mod is never set to -1 */
//if (canvas_last_glist_mod == -1)
// canvas_doclick(x, xpos, ypos, 0, \
// (glob_shift + glob_ctrl*2 + glob_alt*4), 0);
// now dispatch to any click listeners
canvas_dispatch_mouseclick(0., xpos, ypos, which);
}
......@@ -5933,8 +5940,8 @@ void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
//fprintf(stderr,"canvas_motion MA_SCROLL\n");
}
else {
//fprintf(stderr,"canvas_motion -> doclick %d %d\n",
// x->gl_editor->e_onmotion, mod);
post("canvas_motion -> doclick %d %d\n", \
x->gl_editor->e_onmotion, mod);
//canvas_getscroll( x);
canvas_doclick(x, xpos, ypos, 0, mod, 0);
//pd_vmess(&x->gl_pd, gensym("mouse"), "ffff",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment