summaryrefslogtreecommitdiff
path: root/user/krita/fix-nullptr-deref.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-08 11:55:32 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-08 11:55:32 +0000
commit9746818e6f2b3d9185cf43285a588e5b5c9d0aa8 (patch)
tree730099788a7d54b044575db456813a85515d80a1 /user/krita/fix-nullptr-deref.patch
parent5b8ca7a090b2c607c9afb91713b098e375542a17 (diff)
downloadpackages-9746818e6f2b3d9185cf43285a588e5b5c9d0aa8.tar.gz
packages-9746818e6f2b3d9185cf43285a588e5b5c9d0aa8.tar.bz2
packages-9746818e6f2b3d9185cf43285a588e5b5c9d0aa8.tar.xz
packages-9746818e6f2b3d9185cf43285a588e5b5c9d0aa8.zip
user/krita: Fix null dereference on startup
Diffstat (limited to 'user/krita/fix-nullptr-deref.patch')
-rw-r--r--user/krita/fix-nullptr-deref.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/user/krita/fix-nullptr-deref.patch b/user/krita/fix-nullptr-deref.patch
new file mode 100644
index 000000000..07c1536a0
--- /dev/null
+++ b/user/krita/fix-nullptr-deref.patch
@@ -0,0 +1,73 @@
+From 97c03e0f3314dae5520deb901dda73d1cf8df201 Mon Sep 17 00:00:00 2001
+From: "Lamarque V. Souza" <lamarque@kde.org>
+Date: Sat, 30 Nov 2019 20:12:21 -0300
+Subject: [PATCH] Fix crash when starting Krita with Qt compiled in debug mode.
+
+This is the backtrace:
+
+0 0x00007ffff38a11cc in KoColorSet::getGroup(QString const&) () from
+/usr/lib64/libkritapigment.so.18
+1 0x00007ffff3d2aa69 in KisPaletteModel::index(int, int, QModelIndex
+const&) const () from /usr/lib64/libkritawidgets.so.18
+2 0x00007ffff5812796 in
+QAbstractItemView::setModel(QAbstractItemModel*) () from
+/usr/lib64/libQt5Widgets.so.5
+3 0x00007ffff582e749 in QHeaderView::setModel(QAbstractItemModel*) ()
+from /usr/lib64/libQt5Widgets.so.5
+4 0x00007ffff5871493 in QTableView::setModel(QAbstractItemModel*) ()
+from /usr/lib64/libQt5Widgets.so.5
+5 0x00007ffff3d31e17 in
+KisPaletteView::setPaletteModel(KisPaletteModel*) () from
+/usr/lib64/libkritawidgets.so.18
+6 0x00007ffff3d2691e in
+KisDlgInternalColorSelector::KisDlgInternalColorSelector(QWidget*,
+KoColor, KisDlgInternalColorSelector::Config, QString const&,
+KoColorDisplayRendererInterface const*) () from
+/usr/lib64/libkritawidgets.so.18
+7 0x00007ffff7000d67 in
+KoDualColorButton::Private::init(KoDualColorButton*) () from
+/usr/lib64/libkritaui.so.18
+8 0x00007ffff7002c5b in KoDualColorButton::KoDualColorButton(KoColor
+const&, KoColor const&, KoColorDisplayRendererInterface const*,
+QWidget*, QWidget*) ()
+ from /usr/lib64/libkritaui.so.18
+9 0x00007ffff6e2b5b5 in KisControlFrame::setup(QWidget*) () from
+/usr/lib64/libkritaui.so.18
+10 0x00007ffff71014ea in KisViewManager::KisViewManager(QWidget*,
+KActionCollection*) () from /usr/lib64/libkritaui.so.18
+11 0x00007ffff70cb72b in KisMainWindow::KisMainWindow(QUuid) () from
+/usr/lib64/libkritaui.so.18
+12 0x00007ffff70d8352 in KisPart::createMainWindow(QUuid) () from
+/usr/lib64/libkritaui.so.18
+13 0x00007ffff70d85de in KisPart::startBlankSession() () from
+/usr/lib64/libkritaui.so.18
+14 0x00007ffff70995b9 in KisApplication::start(KisApplicationArguments
+const&) () from /usr/lib64/libkritaui.so.18
+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.
+---
+ libs/widgets/KisPaletteModel.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libs/widgets/KisPaletteModel.cpp b/libs/widgets/KisPaletteModel.cpp
+index f1c4e71f8b..464c7f0dba 100644
+--- a/libs/widgets/KisPaletteModel.cpp
++++ b/libs/widgets/KisPaletteModel.cpp
+@@ -94,6 +94,9 @@ QModelIndex KisPaletteModel::index(int row, int column, const QModelIndex& paren
+ Q_UNUSED(parent);
+ Q_ASSERT(m_colorSet);
+ int groupNameRow = groupNameRowForRow(row);
++ if (groupNameRow == -1) {
++ return {};
++ }
+ KisSwatchGroup *group = m_colorSet->getGroup(m_rowGroupNameMap[groupNameRow]);
+ Q_ASSERT(group);
+ return createIndex(row, column, group);
+--
+2.24.1
+