Repository navigation
Description
Prerequisites
- I searched open issues and discussions and did not find an existing report of this bug.
- This is not a security vulnerability.
- I am running the latest code from the
devbranch and the bug still reproduces there.
Odysseus Revision
dev @ 22f937c5
Install Method
Manual Python install (pip / venv)
Operating System
Linux
Steps to Reproduce
- Gallery, Edit tab, click a template (Square HD for example).
- Close the edit with the x on the Edit tab and confirm.
- Repeat 1 and 2 three more times, then open a template a fifth time.
- Press Ctrl+K.
Expected Behaviour
One command palette opens.
Actual Behaviour
Five .ge-command-palette overlays open on top of each other, one per editor session.
Every open/close of the editor leaves listeners on window and document behind. I counted them by wrapping addEventListener/removeEventListener in Chromium: 239, 269, 301, 333 live global listeners after closes 1 to 4, so about 31 per cycle (9 resize, 7 keydown, 7 click, 4 pointerdown, plus pointermove, pointerup, focusin, mousemove, mouseup). The palette overlay appended to body by editor/build/command-palette.js is never removed either.
The leaked handlers check state.editorOpen, which is true again on the next open, so the old closures keep running against detached DOM. That is why Ctrl+K fires once per stale session.
Sources: the listeners _buildEditor and _wireAiCommandBox register in static/js/galleryEditor.js (for example onCommandPaletteKey, the capture-phase Escape interceptor, the topbar resize handlers, the text/shape "More" pointerdown closers), plus the document/window listeners in 13 static/js/editor/* modules. closeEditor only removes the click-away handlers and the popup Escape handlers. canvas-events.js, keyboard-shortcuts.js and clipboard-and-drop.js keep their own AbortController, but only abort it on the next open, not on close.
Second, smaller defect in the same teardown: closeEditor() without force removes the ge-editor-open body class, cancels the pen path and stops the agent bridge (window.__geEditorBridge = null) before it checks whether it may close. When it then refuses ("Close the edit tab first") and returns false, the editor stays open with no bridge, so gePhotoEditorApply waits for a bridge that never comes back. The Gallery buttons check before calling, so they don't hit it; a direct call to window.geGalleryEditor.closeEditor() does:
window.__galleryAllowCloseEditor = false;
window.geGalleryEditor.closeEditor(); // false
window.__geEditorBridge; // null
window.geGalleryEditor.isEditorOpen(); // trueLogs / Screenshots
Screenshot after four reopens: five stacked palettes.
Are you willing to submit a fix?
Yes, I can open a PR
Additional Information
This blocks moving editor event wiring out of galleryEditor.js (#4071): the wiring should not move while it leaks.

Activity