Fix stubbed Fyne Run to block until windows close#14
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func (w *stubWindow) Close() { | ||
| if w.closeIntercept != nil { | ||
| w.closeIntercept() | ||
| w.mu.Lock() | ||
| if w.closed { | ||
| w.mu.Unlock() | ||
| return | ||
| } | ||
| w.closed = true | ||
| intercept := w.closeIntercept | ||
| w.closeIntercept = nil | ||
| w.mu.Unlock() | ||
|
|
||
| if intercept != nil { | ||
| intercept() | ||
| } | ||
|
|
||
| if w.app != nil { | ||
| w.app.windowClosed(w) |
There was a problem hiding this comment.
Honor close intercept before removing window
The stub window now unconditionally marks itself closed and informs the app before invoking the closeIntercept callback. In real Fyne, a close intercept is meant to veto the close until it explicitly calls Close itself. By setting w.closed = true and notifying the app immediately, Run() will unblock even when the intercept decides not to close (e.g. it shows a confirmation dialog and returns). This makes the stub exit early in scenarios where the real GUI would keep running.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68f7d743b130832cab2b911a13d6e4c2