Robustify Linux PDF export against file dialog quirks - #34127
Robustify Linux PDF export against file dialog quirks#34127denisfalqueto wants to merge 3 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR contains two independent fixes. On Linux, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsLinked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped 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. Comment |
0bbf8ab to
dfcc9bf
Compare
|
I just did a rebase on branch master to get some fixes for my personal use. |
41a50ba to
02f33cb
Compare
02f33cb to
f23d35d
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
077f8c3 to
e7af032
Compare
…ainst file dialog quirks Two independent fixes for PDF export failing/crashing on Linux: - src/app/main.cpp: only force QT_QPA_PLATFORMTHEME=gtk3 when the user hasn't already set it. gtk3 was forced unconditionally to fix keyboard input in the legacy Qt file dialog (musescore#13113), but this also silently overrode any theme the user configured (e.g. "xdgdesktopportal" for proper portal/sandboxed dialog support), which is a likely contributor to file dialogs not respecting the user's desktop environment. The default (gtk3) is unchanged for users who don't set this variable, so musescore#13113 is not reintroduced. QT_QPA_PLATFORM=xcb is left untouched, since it fixes unrelated Wayland issues (VST crashes musescore#28446, panel docking musescore#28352). - src/project/internal/exportprojectscenario.cpp: after the file dialog returns a save path, force the expected export suffix if the path doesn't already have one of the format's known suffixes. On some Linux native/portal dialogs the extension isn't auto-appended when the user doesn't type one, which previously left exportScores() unable to find a writer for the path, causing the export to silently fail. A companion fix in muse_framework (musescore/muse_framework#139) makes the underlying file dialog request a default suffix directly, which addresses the same root cause at the source for the single-format case; this commit adds a safety net that's independent of dialog backend. Resolves: musescore#33341 Resolves: musescore#33559
660b487 to
6d98db0
Compare
Summary
Fixes two related symptoms reported on Linux (Arch/Manjaro/Fedora/CachyOS,
mostly under KDE Plasma Wayland with Qt 6.11):
xdg-desktop-portalconfiguration.
crashes — including when the file name is typed with the extension.
Resolves #33341, resolves #33559.
Root cause 1 — theme forced unconditionally
src/app/main.cppunconditionally forcesQT_QPA_PLATFORMTHEME=gtk3onLinux. This overrides any theme the user has explicitly configured (e.g.
xdgdesktopportal, for proper native/sandboxed dialog support via theportal), which is a likely contributor to dialogs not respecting the
desktop environment and to instability in some Wayland setups.
Fix: only apply the
gtk3default when the user hasn't already setQT_QPA_PLATFORMTHEME. The default is unchanged for everyone who doesn'tset it.
I want to flag why
gtk3is forced in the first place, for reviewers:it was introduced in #13847 to fix #13113 ("keyboard doesn't work in file
dialogs"), where the legacy Qt widget dialog swallowed keyboard input.
This PR does not change that default, only whether it can be
overridden — so #13113 should not be reintroduced. I also intentionally
left
QT_QPA_PLATFORM=xcbuntouched; it was introduced in #28461 to fixunrelated Wayland issues (VST crash #28446, panel docking #28352) and
removing it risks regressing those.
Root cause 2 — missing extension breaks writer lookup
On some Linux native/portal file dialogs, the extension isn't
auto-appended when the user doesn't type one.
exportScores()insrc/project/internal/exportprojectscenario.cpppicks the writer by thereturned path's suffix (
io::suffix()), so a missing suffix meant nowriter was found and the export silently failed.
Fix: after the dialog returns, force the expected suffix (from
exportType.suffixes) if the returned path doesn't already have one ofthe known suffixes for that export format.
A companion PR in
muse_framework(musescore/muse_framework#139) makes the dialog itself request a
defaultSuffixfor the single-format case, addressing the same rootcause closer to the source. This PR's fix is independent of the dialog
backend and acts as a safety net either way.
Note: I looked into also fixing the analogous "Save As" ambiguity for
.msczvs. the experimental uncompressed-folder option(
src/project/internal/opensaveprojectscenario.cpp), butselectSavingFileSync()doesn't currently report which of the twofilters the user selected, making a suffix-based heuristic there
genuinely ambiguous (forcing
.msczon empty suffix would break thefolder option for users who select it correctly). Left that out of scope
for this PR rather than risk a different regression.
Testing
Built locally (Debug) and manually tested on KDE Plasma Wayland, with the
companion
muse_frameworkbranch checked out:name.pdf(previously failed/crashed)..pdfexplicitly → still works, no duplicatedsuffix.
Enter to confirm) → works normally, no regression of [MU4 Issue] keyboard doesn't work in file dialogs #13113.
Disclaimer
This change was implemented with the assistance of Claude Code (Anthropic),
which performed the code changes, the build, and the testing steps
described above. A human reviewed and validated the entire process step by
step, and endorses the final result.