Files
GoldenCheetah/unittests/unittests.pro
Magnus Gille 9bb90e3737 Fix crash safety issues: Unsafe signal connections and tree child access (#4761)
Systematically resolved 30 identified potential crash vectors and established automated regression testing to prevent strict reoccurrence.

Key Changes:
- Fixed 11 instances of unsafe `QObject::connect` calls (missing context object) in srd/Charts/AgendaWindow.cpp, FixSpikes.cpp, src/FileIO/FixSpikes.cpp, src/Gui/Agenda.cpp, src/Gui/BatchProcessingDialog.cpp, and src/Gui/IconManager.cpp. This prevents crashes caused by signals firing after the receiver has been destroyed.
- Fixed 19 instances of unsafe `QTreeWidgetItem` child access in src/Charts/LTMChartParser.cpp, src/Gui/ColorButton.cpp, src/Gui/AthletePages.cpp, and src/Gui/Pages.cpp by adding defensive `nullptr` checks before dereferencing.
- Added Python detection scripts util/check_unsafe_connects.py and util/check_unsafe_tree_child.py to statically analyze the codebase for these specific unsafe patterns.
- Integrated detection scripts into the regression test suite under `unittests/Core/signalSafety`, verifying the fixes and enforcing a strict zero-tolerance policy for future regressions.
- Added `testSplineCrash` to cover edge cases with empty spline lookups.
2025-12-17 13:52:38 -03:00

19 lines
408 B
Prolog

TEMPLATE = subdirs
exists(unittests.pri) {
include(unittests.pri)
}
equals(GC_UNITTESTS, active) {
SUBDIRS += Core/seasonOffset \
Core/season \
Core/seasonParser \
Core/units \
Core/signalSafety \
Core/splineCrash \
Gui/calendarData
CONFIG += ordered
} else {
message("Unittests are disabled; to enable copy unittests/unittests.pri.in to unittests/unittests.pri")
}