From ed623934e343b0ab5d252e2e5367dae05e7a9aa2 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 2 Nov 2017 23:14:41 -0400
Subject: [PATCH] port from vanilla:  fix for old bug... (tcl errors on closing
 a patch in which a scalar was getting a deferred update, usually I think
 because of an array).

commit: 418c7380b066db065dcc8a3315f4a6ca61f7bf1c
---
 pd/src/g_scalar.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index f45cbee94..6c0a342a8 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -1103,17 +1103,20 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
 
 static void scalar_doredraw(t_gobj *client, t_glist *glist)
 {
-    scalar_vis(client, glist, 0);
-    scalar_vis(client, glist, 1);
-    if (glist_isselected(glist_getcanvas(glist), (t_gobj *)glist))
+    if (glist_isvisible(glist))
     {
-        //fprintf(stderr,"yes\n");
-        /* I still don't understand what this does... should probably
-           do some scalar gop tests to see if it is actually needed... */
-        //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n",
-        //    glist_getcanvas(glist), glist, 1);
+        scalar_vis(client, glist, 0);
+        scalar_vis(client, glist, 1);
+        if (glist_isselected(glist_getcanvas(glist), (t_gobj *)glist))
+        {
+            //fprintf(stderr,"yes\n");
+            /* I still don't understand what this does... should probably
+               do some scalar gop tests to see if it is actually needed... */
+            //sys_vgui("pdtk_select_all_gop_widgets .x%lx %lx %d\n",
+            //    glist_getcanvas(glist), glist, 1);
+        }
+        canvas_getscroll(glist_getcanvas(glist));
     }
-    canvas_getscroll(glist_getcanvas(glist));
 }
 
 void scalar_redraw(t_scalar *x, t_glist *glist)
-- 
GitLab