fix(ui): hide the Test Exception button outside debug builds - #150
Merged
Conversation
The button calls SettingsModel::testCrash(), which deliberately throws. It was gated only on `SettingsModel.loggingEnabled` — and logging is enabled by default — so it shipped to end users, who found a red "Test Exception" button in Settings and clicked it. Issue #146 is a genuine crash report from a user on Fedora 43 running 0.3.6, titled "Test crash from UI". Add a CONSTANT `debugBuild` property (false when QT_NO_DEBUG is defined) and gate the button on it. Every packaging path builds with CMAKE_BUILD_TYPE=Release, which defines QT_NO_DEBUG and NDEBUG, so the button is absent from all shipped packages while staying available for development. Closes #146
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.
Problem
The "Test Exception" button in Settings calls
SettingsModel::testCrash(), which deliberately throws. It was gated only on:Logging is enabled by default, so this shipped to end users — a red crash button sitting in the Settings page. #146 is a real crash report from a user on Fedora 43 running 0.3.6, titled
St13runtime_error: Test crash from UI. They found the button and pressed it, and the crash handler dutifully filed it.Fix
Add a
CONSTANTdebugBuildproperty toSettingsModel(false whenQT_NO_DEBUGis defined) and gate the button onSettingsModel.debugBuild && SettingsModel.loggingEnabled.Verified this actually holds for shipped builds rather than assuming it: configuring with
CMAKE_BUILD_TYPE=Releaseand inspectingcompile_commands.jsonshows bothQT_NO_DEBUGandNDEBUGare defined. Every packaging path —packaging/PKGBUILD,scripts/package-deb.sh,scripts/package-rpm.sh, andpkg/obs/logitune.spec— builds Release, so the button is absent from all shipped packages while remaining available during development.Tests
Two added to
test_settings_model.cpp:DebugBuildPropertyIsExposedToQml— guards against the property being removed or renamed, which would silently make the QML bindingundefined(and therefore falsy, hiding it even in debug)DebugBuildReflectsBuildConfiguration— asserts the value tracks the build configuration in both directionsFull suite green: 754 C++ / 72 QML.
Closes #146