Skip to content

fix(ui): hide the Test Exception button outside debug builds - #150

Merged
mmaher88 merged 1 commit into
masterfrom
fix-hide-test-crash-button
Jul 28, 2026
Merged

fix(ui): hide the Test Exception button outside debug builds#150
mmaher88 merged 1 commit into
masterfrom
fix-hide-test-crash-button

Conversation

@mmaher88

Copy link
Copy Markdown
Owner

Problem

The "Test Exception" button in Settings calls SettingsModel::testCrash(), which deliberately throws. It was gated only on:

visible: SettingsModel.loggingEnabled

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 CONSTANT debugBuild property to SettingsModel (false when QT_NO_DEBUG is defined) and gate the button on SettingsModel.debugBuild && SettingsModel.loggingEnabled.

Verified this actually holds for shipped builds rather than assuming it: configuring with CMAKE_BUILD_TYPE=Release and inspecting compile_commands.json shows both QT_NO_DEBUG and NDEBUG are defined. Every packaging path — packaging/PKGBUILD, scripts/package-deb.sh, scripts/package-rpm.sh, and pkg/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 binding undefined (and therefore falsy, hiding it even in debug)
  • DebugBuildReflectsBuildConfiguration — asserts the value tracks the build configuration in both directions

Full suite green: 754 C++ / 72 QML.

Closes #146

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
@mmaher88
mmaher88 merged commit 7c63394 into master Jul 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash: St13runtime_error: Test crash from UI

1 participant