Skip to content

fix(linux): release the GTK window and webview objects on close - #3

Merged
pappz merged 1 commit into
integrationfrom
fix/linux-gtk4-webkit-process-leak
Aug 25, 2026
Merged

fix(linux): release the GTK window and webview objects on close#3
pappz merged 1 commit into
integrationfrom
fix/linux-gtk4-webkit-process-leak

Conversation

@pappz

@pappz pappz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • WEP (proposal only; no implementation)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • (v2 only) I have updated website/src/pages/changelog.mdx with details of this PR (v3 changelog entries are added automatically)
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

windowNew sinks a reference into every GtkApplicationWindow it creates, but
close() only called gtk_window_destroy, which unmaps the window and dissolves
the widget tree without freeing it. The sunk reference kept the refcount above
zero, so dispose never ran, the child WebKitWebView stayed alive, and its
WebKitWebProcess was never reaped. Every window opened over a session left one
behind: on a tray application that outlives its windows the residents
accumulated at roughly 100MB each, reaching 662MB of resident process tree
after four open/close cycles where a clean run settles at 238MB.

The reference windowNewWebview takes on the WebKitSettings and the
WebKitUserContentManager leaked the same way. The web view holds its own
reference to both, so hand ours back once it has them.

unregisterWindow now runs before the unref because it only uses the pointer as
a map key, and touching it afterwards would be a use-after-free.
@github-actions github-actions Bot added the v3 label Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • master

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c7f05fb7-3c97-4683-b21d-eef9066ee6c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pappz
pappz merged commit 5f07a01 into integration Aug 25, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants