From 44e1b531e9a3e88fc0d9edf3a9f27a690501b549 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 25 Jun 2014 23:09:34 -0400
Subject: [PATCH] *fixed bug where patch titlebars were not properly re-titled
 after using save-as function (possibly other file I/O operations as well)

---
 pd/src/g_canvas.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 85215ab26..574870a68 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -246,14 +246,14 @@ void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir)
     canvas_unbind(x);
     x->gl_name = s;
     canvas_bind(x);
-    if (glist_isvisible(x))
-    if (x->gl_havewindow) //was glist_isvisible(x)
-        canvas_reflecttitle(x);
     if (dir && dir != &s_)
     {
         t_canvasenvironment *e = canvas_getenv(x);
         e->ce_dir = dir;
     }
+    if (glist_isvisible(x))
+        if (x->gl_havewindow) //was glist_isvisible(x)
+            canvas_reflecttitle(x);
 }
 
 /* --------------- traversing the set of lines in a canvas ----------- */
@@ -659,7 +659,6 @@ t_symbol *canvas_makebindsym(t_symbol *s)
 
 void canvas_reflecttitle(t_canvas *x)
 {
-    //fprintf(stderr,"canvas_reflecttitle\n");
     char namebuf[MAXPDSTRING];
     t_canvasenvironment *env = canvas_getenv(x);
     if (env->ce_argc)
-- 
GitLab