From 18f1901fa175cc0160e6a159b34b112d98f9f8a2 Mon Sep 17 00:00:00 2001
From: Guillem <guillembartrina@gmail.com>
Date: Wed, 9 Sep 2020 11:51:01 +0200
Subject: [PATCH] fix unmarking process, it failed to unmark when a dirty patch
 was deleted

---
 pd/src/g_canvas.c | 4 ++++
 pd/src/g_editor.c | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index f1a8279e2..d81d91108 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -1022,6 +1022,10 @@ extern void canvas_group_free(t_pd *x);
 void canvas_free(t_canvas *x)
 {
     //fprintf(stderr,"canvas_free %lx\n", (t_int)x);
+
+    if(x->gl_dirty)
+        canvas_dirtyclimb(x, 0);
+
     t_gobj *y;
     int dspstate = canvas_suspend_dsp();
 
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 088890360..b96aa0646 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -1288,7 +1288,6 @@ void canvas_undo_paste(t_canvas *x, void *z, int action)
     }
 }
 
-void canvas_dirtyclimb(t_canvas *x, int n);
 int clone_match(t_pd *z, t_symbol *name, t_symbol *dir);
 
     /* recursively check for abstractions to reload as result of a save. 
@@ -1315,10 +1314,6 @@ static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir,
                 ((t_canvas *)g)->gl_name == name &&
                     canvas_getdir((t_canvas *)g) == dir);
 
-        /* remove dirtiness visual markings */
-        if(remakeit && ((t_canvas *)g)->gl_dirty)
-            canvas_dirtyclimb((t_canvas *)g, 0);
-
             /* also remake it if it's a "clone" with that name */
         if (pd_class(&g->g_pd) == clone_class &&
             clone_match(&g->g_pd, name, dir))
-- 
GitLab