Repository navigation
X11: handle unavailable input methods without freeing the default GC - #445
Merged
emoon merged 1 commit intoNov 22, 2026
Merged
Conversation
Owner
|
Thanks! |
emoon
added a commit
that referenced
this pull request
Nov 22, 2026
Move the xic/xim/window release into one helper used by the error paths and Drop, which also stops leaking the window when XCreateIC fails. An XCreateIC failure now degrades to XLookupString like an XOpenIM failure. Add changelog entries for #445 and the fallback.
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.
An X11 window can fail to open its configured input method. At that point
DisplayInfostill holds the display-owned default GC. Freeing it explicitlyand then closing the display can release the same object twice. On an Xvfb
display, this was observable as SIGSEGV from
XCloseDisplay.This patch leaves the GC unowned until
XCreateGCsucceeds, and it frees onlythat owned GC. It retains the configured input method when available. If
XOpenIMfails, the window can still show and accept basic keys without an XIC.The initialization and shutdown paths guard resources that may be absent.
The first reproductions used a minimal RePic GUI session with synthetic images.
With the published 0.29.0 dependency,
XMODIFIERS=@im=ibuson isolated Xvfbreturned 139. The patched library opened and exited normally. A 16-bit Xvfb
display returned a window-creation error with the patch instead of SIGSEGV.
The patch applies to upstream master at
2f9fe002de9d9850218fda3874215e8a4633dc62.Upstream validation
Built the repository's
noiseexample on the same revision before and afterapplying the patch, with separate Cargo target directories:
cargo build --locked --no-default-features --features x11 --example noise XMODIFIERS=@im=ibus xvfb-run -a -s '-screen 0 1280x800x24' target/debug/examples/noiseThe original returned
139. The patched example displayedNoise Test - Press ESC to exitand returned0after Escape.cargo test --locked --no-default-features --features x11 --libpassed all14 upstream unit tests on AArch64 Linux.