aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2024-04-04 09:53:07 +0800
committerPo Lu2024-04-04 09:53:07 +0800
commit42c0603c7aab191c9cc15a7eca1253060ff5b71a (patch)
treeac7902d66ef8f23a3f5ec0ec496f6d4484906518 /java
parent3608c1399ffdb130311e2d3674ff4037188d79d8 (diff)
downloademacs-42c0603c7aab191c9cc15a7eca1253060ff5b71a.tar.gz
emacs-42c0603c7aab191c9cc15a7eca1253060ff5b71a.zip
Avoid destroying windows after they are unmapped
* java/org/gnu/emacs/EmacsActivity.java (destroy): Detach from current window before calling finish. * java/org/gnu/emacs/EmacsWindow.java (reparentTo): Don't clear attachment state here... * java/org/gnu/emacs/EmacsWindowManager.java (detachWindow): ...but do so here instead.
Diffstat (limited to 'java')
-rw-r--r--java/org/gnu/emacs/EmacsActivity.java12
-rw-r--r--java/org/gnu/emacs/EmacsWindow.java4
-rw-r--r--java/org/gnu/emacs/EmacsWindowManager.java12
3 files changed, 20 insertions, 8 deletions
diff --git a/java/org/gnu/emacs/EmacsActivity.java b/java/org/gnu/emacs/EmacsActivity.java
index a939641a752..28bb6e4c065 100644
--- a/java/org/gnu/emacs/EmacsActivity.java
+++ b/java/org/gnu/emacs/EmacsActivity.java
@@ -207,6 +207,18 @@ public class EmacsActivity extends Activity
207 public final void 207 public final void
208 destroy () 208 destroy ()
209 { 209 {
210 if (window != null)
211 {
212 /* Clear the window's pointer to this activity and remove the
213 window's view. */
214 window.setConsumer (null);
215
216 /* The window can't be iconified any longer. */
217 window.noticeDeiconified ();
218 layout.removeView (window.view);
219 window = null;
220 }
221
210 finish (); 222 finish ();
211 } 223 }
212 224
diff --git a/java/org/gnu/emacs/EmacsWindow.java b/java/org/gnu/emacs/EmacsWindow.java
index b085614de23..91e97fa8b61 100644
--- a/java/org/gnu/emacs/EmacsWindow.java
+++ b/java/org/gnu/emacs/EmacsWindow.java
@@ -1322,10 +1322,6 @@ public final class EmacsWindow extends EmacsHandleObject
1322 manager = EmacsWindowManager.MANAGER; 1322 manager = EmacsWindowManager.MANAGER;
1323 manager.detachWindow (EmacsWindow.this); 1323 manager.detachWindow (EmacsWindow.this);
1324 1324
1325 /* Reset window management state. */
1326 previouslyAttached = false;
1327 attachmentToken = 0;
1328
1329 /* Also unparent this view. */ 1325 /* Also unparent this view. */
1330 1326
1331 /* If the window manager is set, use that instead. */ 1327 /* If the window manager is set, use that instead. */
diff --git a/java/org/gnu/emacs/EmacsWindowManager.java b/java/org/gnu/emacs/EmacsWindowManager.java
index 21df77587b0..a239fdc8ac2 100644
--- a/java/org/gnu/emacs/EmacsWindowManager.java
+++ b/java/org/gnu/emacs/EmacsWindowManager.java
@@ -238,15 +238,19 @@ public final class EmacsWindowManager
238 { 238 {
239 WindowConsumer consumer; 239 WindowConsumer consumer;
240 240
241 if (window.getAttachedConsumer () != null) 241 /* Reset window management state. */
242 { 242 window.previouslyAttached = false;
243 consumer = window.getAttachedConsumer (); 243 window.attachmentToken = 0;
244
245 /* Remove WINDOW from the list of active windows. */
246 windows.remove (window);
244 247
248 if ((consumer = window.getAttachedConsumer ()) != null)
249 {
245 consumers.remove (consumer); 250 consumers.remove (consumer);
246 consumer.destroy (); 251 consumer.destroy ();
247 } 252 }
248 253
249 windows.remove (window);
250 pruneWindows (); 254 pruneWindows ();
251 } 255 }
252 256