From 7f0df3bd62df2d680b1fbbe192224fb98e050530 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Mon, 17 Mar 2014 15:21:59 -0400
Subject: [PATCH] code clean-up and enabling bunch of debugging to hunt down
 the infinite recursion in the scalar-help.pd (select the left object and
 observe your own aging process)

---
 pd/src/g_scalar.c   | 8 +++++---
 pd/src/g_template.c | 2 --
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index f46452f18..b61d2e691 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -248,6 +248,7 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
 
 void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
 {
+    fprintf(stderr,"scalar_drawselecterect%d\n", state);
     if (state)
     {
         int x1, y1, x2, y2;
@@ -298,7 +299,7 @@ void scalar_select(t_gobj *z, t_glist *owner, int state)
     t_template *tmpl;
     t_symbol *templatesym = x->sc_template;
     t_atom at;
-    t_canvas *templatecanvas = NULL;
+    //t_canvas *templatecanvas = NULL;
     t_gpointer gp;
     gpointer_init(&gp);
     gpointer_setglist(&gp, owner, x);
@@ -308,12 +309,13 @@ void scalar_select(t_gobj *z, t_glist *owner, int state)
         fprintf(stderr,"blah\n");
         template_notify(tmpl, (state ? gensym("select") : gensym("deselect")),
             1, &at);
-        templatecanvas = template_findcanvas(tmpl);
+        //templatecanvas = template_findcanvas(tmpl);
     }
     gpointer_unset(&gp);
+    fprintf(stderr,"continue\n");
     if (state)
     {
-                x->sc_selected = owner;
+        x->sc_selected = owner;
         sys_vgui(".x%lx.c addtag selected withtag blankscalar%lx\n",
             glist_getcanvas(owner), x);
         /* how do we navigate through a t_word list?
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index a33a53d5d..f64f33999 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -4476,8 +4476,6 @@ static int plot_click(t_gobj *z, t_glist *glist,
     else return (0);
 }
 
-extern int we_are_undoing;
-
 static void plot_free(t_plot *x)
 {
     //fprintf(stderr,"plot_free\n");
-- 
GitLab