From 9746818e6f2b3d9185cf43285a588e5b5c9d0aa8 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 8 Feb 2020 11:55:32 +0000 Subject: user/krita: Fix null dereference on startup --- user/krita/APKBUILD | 10 +++--- user/krita/fix-nullptr-deref.patch | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 user/krita/fix-nullptr-deref.patch (limited to 'user') diff --git a/user/krita/APKBUILD b/user/krita/APKBUILD index 44dcca839..0150420b8 100644 --- a/user/krita/APKBUILD +++ b/user/krita/APKBUILD @@ -17,7 +17,9 @@ makedepends="cmake extra-cmake-modules qt5-qtbase-dev karchive-dev kconfig-dev kio-dev eigen-dev exiv2-dev lcms2-dev poppler-qt5-dev gsl-dev libxi-dev libraw-dev quazip-dev giflib-dev poppler-dev" subpackages="$pkgname-lang" -source="https://download.kde.org/stable/krita/4.2.8/krita-$pkgver.tar.gz" +source="https://download.kde.org/stable/krita/4.2.8/krita-$pkgver.tar.gz + fix-nullptr-deref.patch + " build() { if [ "$CBUILD" != "$CHOST" ]; then @@ -38,12 +40,12 @@ build() { } check() { - cd "$builddir"/build - CTEST_OUTPUT_ON_FAILURE=TRUE ctest + CTEST_OUTPUT_ON_FAILURE=TRUE make -C build test } package() { make DESTDIR="$pkgdir" -C build install } -sha512sums="aab4096bef81a7205a04e3a4080d95ccbd1ba84a0cdb959fca8a0e6e7e8183f79857bde0b301dd9db642bd71042ef43b99768dbb7cd91d32e93df3da391d1a4b krita-4.2.8.2.tar.gz" +sha512sums="aab4096bef81a7205a04e3a4080d95ccbd1ba84a0cdb959fca8a0e6e7e8183f79857bde0b301dd9db642bd71042ef43b99768dbb7cd91d32e93df3da391d1a4b krita-4.2.8.2.tar.gz +fd43f21da937c29f550e24d459e83ad9714befe82fe0cae493b28cad6526b11f80a5e3d350be1fa910a62c07284774a6f5fac4bbf4801be378987fbfaef61254 fix-nullptr-deref.patch" 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" +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 + -- cgit v1.2.3-70-g09d2