Skip to content

Commit f1699ea

Browse files
authored
Merge pull request #16052 from daschuer/valgrind_columncache
Avoid conditional jump that depends on uninitialized memory
2 parents 3384930 + 8ccae29 commit f1699ea

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/library/columncache.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ ColumnCache::ColumnCache() {
189189
m_pKeyNotationCP = new ControlProxy(mixxx::library::prefs::kKeyNotationConfigKey, this);
190190
m_pKeyNotationCP->connectValueChanged(this, &ColumnCache::slotSetKeySortOrder);
191191

192+
// Used in BaseTrackTableModel() along with a later setColumns() call.
192193
// ColumnCache is initialized before the preferences, so slotSetKeySortOrder is called
193-
// for again if DlgPrefKey sets the [Library]. key_notation CO to a value other than
194+
// again if DlgPrefKey sets the [Library]. key_notation CO to a value other than
194195
// KeyUtils::CUSTOM as Mixxx is starting.
195196
}
196197

@@ -240,6 +241,10 @@ void ColumnCache::setColumns(QStringList columns) {
240241
}
241242

242243
void ColumnCache::slotSetKeySortOrder(double notationValue) {
244+
if (m_columnsByIndex.isEmpty()) {
245+
// we are not caching columns yet
246+
return;
247+
}
243248
const int keyColumnIndex = m_columnIndexByEnum[COLUMN_LIBRARYTABLE_KEY];
244249
if (keyColumnIndex < 0) {
245250
return;

0 commit comments

Comments
 (0)