Commit eb144b6f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix a crasher when attempting to resize a nested gop by dragging its corner

We were erroneously using canvas_getrootfor instead of glist_getcanvas to
find the canvas on which the nested gop was being displayed.

Also added a consistency check to turn such a crasher into a runtime bug
in the future.
parent 4b7b73cd
Pipeline #2042 passed with stage
in 337 minutes and 28 seconds
......@@ -2399,7 +2399,7 @@ void canvasgop__motionhook(t_scalehandle *sh, t_floatarg mouse_x,
that is being used to draw the gop red rect move anchor atm. So
rather than muck around with that code, we just set a pointer to
whatever our toplevel is here: */
t_glist *owner = canvas_getrootfor(x);
t_glist *owner = glist_getcanvas(x);
/* Just unvis the object, then vis it once we've done our
mutation and checks */
gobj_vis((t_gobj *)x, owner, 0);
......
......@@ -879,6 +879,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
char tag[50];
t_gobj *g;
int x1, y1, x2, y2;
t_rtext *rtext;
/* ordinary subpatches: just act like a text object */
if (!x->gl_isgraph)
{
......@@ -886,6 +887,14 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
return;
}
/* Sanity check */
rtext = glist_findrtext(parent_glist, &x->gl_obj);
if (!rtext)
{
bug("graph_vis");
return;
}
sprintf(tag, "%s", rtext_gettag(rtext));
// weird exception
//int exception = 0;
//t_canvas* tgt = glist_getcanvas(x->gl_owner);
......@@ -896,8 +905,6 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
//}
//fprintf(stderr,"tgt=.x%lx %d\n", (t_int)tgt, exception);
sprintf(tag, "%s", rtext_gettag(glist_findrtext(parent_glist, &x->gl_obj)));
if (vis & gobj_shouldvis(gr, parent_glist))
{
int xpix, ypix;
......
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