From 154faa0036bf5cbef546a140251a7cd05e8e4ef6 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 15 Feb 2012 22:31:31 -0500
Subject: [PATCH] fixed confirming saving changes on an abstraction hidden
 inside another patch (currently invisible) whose prompting failed...

---
 src/g_canvas.c | 8 ++++++--
 src/g_editor.c | 9 ++++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/g_canvas.c b/src/g_canvas.c
index 3384ece3e..972580d06 100644
--- a/src/g_canvas.c
+++ b/src/g_canvas.c
@@ -875,7 +875,11 @@ void glist_menu_open(t_glist *x)
                     /* redraw ourself in parent window (blanked out this time) */
             gobj_vis(&x->gl_gobj, gl2, 1);
         }
-    }
+    } else {
+        if (x->gl_editor)
+            canvas_destroy_editor(x);
+		x->gl_havewindow = 1;
+	}
     canvas_vis(x, 1);
 }
 
@@ -987,7 +991,7 @@ void canvas_deletelinesfor(t_canvas *x, t_text *text)
     {
         if (t.tr_ob == text || t.tr_ob2 == text)
         {
-            if (x->gl_editor)
+            if (x->gl_editor && glist_isvisible(glist_getcanvas(x)))
             {
                 sys_vgui(".x%lx.c delete l%lx\n",
                     glist_getcanvas(x), oc);
diff --git a/src/g_editor.c b/src/g_editor.c
index da73d6881..046906793 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -3455,7 +3455,14 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
         g = glist_finddirty(x);
         if (g)
         {
-            vmess(&g->gl_pd, gensym("menu-open"), "");
+			if (!glist_istoplevel(g) && g->gl_env) {
+				/* if this is an abstraction */
+            	vmess(&g->gl_pd, gensym("menu-open"), "");
+			} else {
+				/* is this even necessary? */
+	            canvas_vis(g, 1);
+			}
+            //vmess(&g->gl_pd, gensym("menu-open"), "");
 			if (!glist_istoplevel(g) && g->gl_env) {
 				/* if this is an abstraction */
             	sys_vgui("pdtk_canvas_menuclose .x%lx {.x%lx menuclose 2;}\n",
-- 
GitLab