fix: avoid delay when page.window.destroy() closes Windows apps#6428
Open
ndonkoHenri wants to merge 3 commits intorelease/v0.85.0from
Open
fix: avoid delay when page.window.destroy() closes Windows apps#6428ndonkoHenri wants to merge 3 commits intorelease/v0.85.0from
page.window.destroy() closes Windows apps#6428ndonkoHenri wants to merge 3 commits intorelease/v0.85.0from
Conversation
Deploying flet-website-v2 with
|
| Latest commit: |
e26022b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8d8f99cb.flet-website-v2.pages.dev |
| Branch Preview URL: | https://fix-window-destroy.flet-website-v2.pages.dev |
Deploying flet-examples with
|
| Latest commit: |
e26022b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://776359dd.flet-examples.pages.dev |
| Branch Preview URL: | https://fix-window-destroy.flet-examples.pages.dev |
Contributor
There was a problem hiding this comment.
Pull request overview
Addresses a Windows-specific shutdown stall when calling page.window.destroy() while prevent_close is enabled, aligning Flet’s behavior with the documented window_manager workaround.
Changes:
- On Windows,
destroyWindow()now disablespreventClose(if set) and callswindowManager.close()instead ofwindowManager.destroy()to avoid the stall. - Added a root
CHANGELOG.mdentry documenting the Windows fix and referencing issue #5459.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/flet/lib/src/utils/desktop.dart | Implements the Windows-specific workaround in destroyWindow() to prevent multi-second close delays. |
| CHANGELOG.md | Documents the user-facing fix for Windows desktop app shutdown delays. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a Windows-specific delay where
page.window.destroy()could take several seconds to terminate whenprevent_closewas enabled. The Windows path now disables native close interception and callswindowManager.close()instead ofwindowManager.destroy(), matching the upstream workaround for thewindow_managershutdown stall.Resolves #5459
Test Code
https://flet.dev/docs/controls/page#app-exit-confirmation
Summary by Sourcery
Resolve a Windows-specific shutdown delay by changing how desktop window destruction is handled when closing apps.
Bug Fixes:
page.window.destroy()closes Windows desktop apps withprevent_closeenabled by disabling close prevention and using a normal window close instead of destruction.Documentation: