Repository navigation
Conversation
`gtk_file_chooser_native_new` returns a reference owned by the caller, but `GtkFileDialog::drop` only called `gtk_native_dialog_destroy`, which does not release it. In GTK 3 the native dialog destroys its fallback `GtkFileChooserDialog` only when finalized, so every file dialog left a hidden `GtkFileChooserDialog` alive. Fixes PolyMeilex#365 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
|
Could you run https://github.com/PolyMeilex/rfd/tree/master/examples%2Fgtk-threading-manual-tests |
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 #365.
gtk_file_chooser_native_newreturns a reference owned by the caller, butGtkFileDialog::droponly calledgtk_native_dialog_destroy, which does not release it (see the note ingtknativedialog.c). In GTK 3,GtkFileChooserNativedestroys its fallbackGtkFileChooserDialogonly infinalize. So every GTK3 file dialog (sync and async, all pickers andsave_file) left a hiddenGtkFileChooserDialogalive. This adds the missingg_object_unrefaftergtk_native_dialog_destroy.The async path drops the dialog from inside its own
responsehandler. GLib holds a reference on the instance for the duration of the emission, so finalization happens after the handler returns.Testing
I ran the program from #365 (30 dialogs, each cancelled from a GLib timeout) plus an
AsyncFileDialogvariant run withpollster::block_on, on Xvfb with GTK 3.24.33 (Ubuntu 22.04):There were no GTK criticals or warnings in either run.
cargo fmt --check,cargo buildandcargo testwith--no-default-features --features gtk3pass, andcargo clippyreports the same warnings as on master.🤖 Generated with Claude Code