Commit 97c03e0f authored by Lamarque Souza's avatar Lamarque Souza

Fix crash when starting Krita with Qt compiled in debug mode.

This is the backtrace:

0  0x00007ffff38a11cc in KoColorSet::getGroup(QString const&) () from
1  0x00007ffff3d2aa69 in KisPaletteModel::index(int, int, QModelIndex
const&) const () from /usr/lib64/
2  0x00007ffff5812796 in
QAbstractItemView::setModel(QAbstractItemModel*) () from
3  0x00007ffff582e749 in QHeaderView::setModel(QAbstractItemModel*) ()
from /usr/lib64/
4  0x00007ffff5871493 in QTableView::setModel(QAbstractItemModel*) ()
from /usr/lib64/
5  0x00007ffff3d31e17 in
KisPaletteView::setPaletteModel(KisPaletteModel*) () from
6  0x00007ffff3d2691e in
KoColor, KisDlgInternalColorSelector::Config, QString const&,
KoColorDisplayRendererInterface const*) () from
7  0x00007ffff7000d67 in
KoDualColorButton::Private::init(KoDualColorButton*) () from
8  0x00007ffff7002c5b in KoDualColorButton::KoDualColorButton(KoColor
const&, KoColor const&, KoColorDisplayRendererInterface const*,
QWidget*, QWidget*) ()
  from /usr/lib64/
9  0x00007ffff6e2b5b5 in KisControlFrame::setup(QWidget*) () from
10 0x00007ffff71014ea in KisViewManager::KisViewManager(QWidget*,
KActionCollection*) () from /usr/lib64/
11 0x00007ffff70cb72b in KisMainWindow::KisMainWindow(QUuid) () from
12 0x00007ffff70d8352 in KisPart::createMainWindow(QUuid) () from
13 0x00007ffff70d85de in KisPart::startBlankSession() () from
14 0x00007ffff70995b9 in KisApplication::start(KisApplicationArguments
const&) () from /usr/lib64/
15 0x0000555555e4e229 in main ()

The KisPaletteModel::index() call is inside an Q_ASSERT_X in
QAbstractItemView::setModel(), so you have to compile Qt in debug mode
to reproduce this crash.

m_rowGroupNameMap is empty during the startup.
parent 71ca2f24
......@@ -94,6 +94,9 @@ QModelIndex KisPaletteModel::index(int row, int column, const QModelIndex& paren
int groupNameRow = groupNameRowForRow(row);
if (groupNameRow == -1) {
return {};
KisSwatchGroup *group = m_colorSet->getGroup(m_rowGroupNameMap[groupNameRow]);
return createIndex(row, column, group);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment