fix: parent background image dialog to top-level window, use Qt dialog#2865
Open
NF0T wants to merge 1 commit into
Open
fix: parent background image dialog to top-level window, use Qt dialog#2865NF0T wants to merge 1 commit into
NF0T wants to merge 1 commit into
Conversation
The "Choose Background Image" file dialog was parented to the SpectrumWidget (a QRhiWidget with a native hardware render surface). On X11/Wayland the window manager cannot reliably establish a transient-for relationship with a QRhi surface, causing the modal grab to wedge the GUI thread and the application to become unresponsive. The native portal/GTK/KDE dialog backend compounds this on Linux Mint and similar desktops where the portal is absent or misconfigured — the blocking call never returns. Fix: parent the dialog to sw->window() (the top-level QMainWindow) so the WM gets a valid transient-for target, and pass DontUseNativeDialog to bypass the portal/backend entirely. Both changes are independently sufficient; together they cover the full Linux DE matrix. No other getOpenFileName call sites are affected — all parent to ordinary QWidget/QDialog instances, not QRhi surfaces. Fixes aethersdr#723. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Looks good. Thanks @NF0T — clear root cause writeup and a minimal, targeted fix.
Verified the analysis:
SpectrumWidgetisQRhiWidgetwhenSPECTRUM_BASE_CLASSis the GPU path (src/gui/SpectrumWidget.h:22), confirming the transient-for problem.- All other
QFileDialog::getOpenFileNamecall sites (RadioSetupDialog,DvkPanel,MemoryDialog,DxClusterDialog,ProfileImportExportDialog,AetherialAudioStrip) parent tothison standardQWidget/QDialogsubclasses, so they're unaffected by the same root cause.
Two argument changes, no new failure modes — sw->window() is non-null for any wired panadapter (it's already been added to the main window tree by the time wirePanadapter runs), and DontUseNativeDialog is a documented Qt flag with no platform guards needed.
The out-of-scope note about synchronous QImage decode on the GUI thread is fair to defer — that's a separate concern from the hang in #723.
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.
Summary
Fixes #723.
Setting a background image via Display → Background → "Choose…" caused AetherSDR to become unresponsive on Linux, requiring a force-kill. The application appeared frozen with no dialog visible.
Root cause
Two compounding problems in the single `QFileDialog::getOpenFileName` call at `MainWindow.cpp:10800`:
1. Wrong parent widget. The dialog was parented to `sw` — the `SpectrumWidget`, which is a `QRhiWidget` backed by a native hardware render surface. On X11/Wayland the window manager cannot reliably establish a transient-for relationship between a native modal dialog and a QRhi surface. The modal grab fires but the dialog cannot receive focus or complete initialization, wedging the GUI thread.
2. Native dialog backend. Without `DontUseNativeDialog`, Qt routes through the platform portal (xdg-desktop-portal, GTK, or KDE depending on desktop environment). On Linux Mint Cinnamon and other environments where the portal is absent or misconfigured, the blocking `getOpenFileName` call never returns.
Either problem alone is sufficient to reproduce the hang; together they make it near-certain on affected Linux desktops.
Fix
Two argument changes to the one affected call site:
Applied unconditionally — no platform guards needed. The Qt dialog renders correctly on all three platforms; the visual difference from the system-native dialog on macOS/Windows is cosmetic only.
Other `getOpenFileName` call sites — not affected
All other file dialog calls in the codebase (`RadioSetupDialog`, `DvkPanel`, `MemoryDialog`, `DxClusterDialog`, `ProfileImportExportDialog`) parent to `this` (a standard QDialog or QWidget), not a QRhi surface. They are unaffected by this root cause and require no changes.
Out of scope
`SpectrumWidget::setBackgroundImage` decodes the image synchronously on the GUI thread (`QImage(path)`). For very large files this could produce a brief stall. This is a pre-existing minor concern, not the cause of the hang reported in #723, and is tracked separately.
Test plan
🤖 Generated with Claude Code