Skip to content

[GTK4] Destroy a popover disposed during a focus change after it - #3759

Merged
akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-popover-dispose-focus
Oct 23, 2026
Merged

akurtakov merged 1 commit into
eclipse-platform:masterfrom
akurtakov:gtk4-popover-dispose-focus

Conversation

@akurtakov

Copy link
Copy Markdown
Member

GTK sends the focus leave events walking up the widget tree from the old focus widget. A popup disposed by a FocusOut listener was popped down and unparented in the middle of that walk, and GTK looped forever on the destroyed widgets.

Queue a popover disposed while a focus callback runs and destroy it after the focus change, from an asyncExec that waits while a listener still runs a nested event loop.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)

GTK sends the focus leave events walking up the widget tree from the
old focus widget. A popup disposed by a FocusOut listener was popped
down and unparented in the middle of that walk, and GTK looped forever
on the destroyed widgets.

Queue a popover disposed while a focus callback runs and destroy it
after the focus change, from an asyncExec that waits while a listener
still runs a nested event loop.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)
@akurtakov
akurtakov requested a balanced review from Copilot October 22, 2026 18:06
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 1 026 files  ±0   1 026 suites  ±0   1h 37m 16s ⏱️ + 17m 34s
 5 067 tests +1   5 039 ✅ +1     28 💤 ±0  0 ❌ ±0 
29 761 runs  +6  27 225 ✅ +6  2 536 💤 ±0  0 ❌ ±0 

Results for commit 5abb709. ± Comparison against base commit e147461.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Fixes a GTK4 focus-change edge case where disposing a popover during FocusOut can cause GTK to loop on destroyed widgets, by deferring popover teardown until after focus dispatch completes.

Changes:

  • Add a regression test that disposes an ON_TOP child shell during FocusOut.
  • Defer gtk_popover_popdown()/gtk_widget_unparent() for popovers disposed inside focus dispatch, and perform the destruction later via asyncExec.
  • Track focus-dispatch depth and queue popover handles for deferred destruction.
File Description
tests/​org.eclipse.swt.tests/​JUnit Tests/​org/​eclipse/​swt/​tests/​junit/​Test_org_eclipse_swt_widgets_Shell.java Adds a regression test that disposes a popup on FocusOut and waits for disposal completion.
bundles/​org.eclipse.swt/​Eclipse SWT/​gtk/​org/​eclipse/​swt/​widgets/​Shell.java Defers popover popdown/unparent when a shell is released during focus dispatch.
bundles/​org.eclipse.swt/​Eclipse SWT/​gtk/​org/​eclipse/​swt/​widgets/​Display.java Adds focus-dispatch depth tracking and deferred popover destruction via asyncExec.

Review effort: Lite

Copilot stopped reviewing on behalf of akurtakov due to an error October 22, 2026 18:28
@akurtakov akurtakov self-assigned this Oct 23, 2026
@akurtakov
akurtakov merged commit 0182d2a into eclipse-platform:master Oct 23, 2026
22 checks passed
@akurtakov
akurtakov deleted the gtk4-popover-dispose-focus branch October 23, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants