Diffusion Krita ef55574a4af7

Fix PaletteDocker not showing palettes
Concern Raisedef55574a4af7

Authored by vanyossi on Dec 19 2019, 6:59 AM.

Description

Fix PaletteDocker not showing palettes

Reverts 97c03e0f3314dae5520deb901dda73d1cf8df201

"-1" is a QMap key to signal "root group"

Changed Q_ASSERT to KIS_ASSERT_RECOVER_RETURN_VALUE to
try and avoid crashing if Qt is compiled in debug mode.

BUG:414890

lvsouza raised a concern with this commit.Jan 8 2020, 4:15 PM
lvsouza added a subscriber: lvsouza.

Krita does not work anymore for me after this change.

/libs/widgets/KisPaletteModel.cpp
98

This change does not prevent triggering the assert since it happens during the m_colorSet->getGroup call in the line above. Maybe the change below solves both problems, please check if it works for you:

--- libs/widgets/KisPaletteModel.cpp    2020-01-08 13:10:46.044655296 -0300
+++ libs/widgets/KisPaletteModel.cpp.lvs        2020-01-08 13:10:36.141320561 -0300
@@ -93,6 +93,9 @@
 {
     Q_UNUSED(parent)
     Q_ASSERT(m_colorSet);
+    if (m_rowGroupNameMap.isEmpty()) {
+        return {};
+    }
     int groupNameRow = groupNameRowForRow(row);
     KisSwatchGroup *group = m_colorSet->getGroup(m_rowGroupNameMap[groupNameRow]);
     KIS_ASSERT_RECOVER_RETURN_VALUE(group,QModelIndex());
This commit now has outstanding concerns.Jan 8 2020, 4:15 PM