Bug 391069 - Crash when adding color to palette and deleting immediately afterwards
Summary: Crash when adding color to palette and deleting immediately afterwards
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Dockers (show other bugs)
Version: 4.0.0-beta.1
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-25 21:38 UTC by Peter Mueller
Modified: 2018-06-04 13:07 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Crash log (24.20 KB, text/plain)
2018-02-25 21:38 UTC, Peter Mueller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Mueller 2018-02-25 21:38:26 UTC
Created attachment 110998 [details]
Crash log

Krita reproducibly crashes when doing the following steps, after selecting a template for drawing:

(1) "Settings / Dockers / Palette" - opens an empty palette docker.
(2) Select "default" palette. (I have to click on the "Choose palette" button, then, select "Default", then click outside the dialog (please note that this is confusing as there's also a Save button which I used first but which does not close this dialog))
(3) Click "+" to add a color (color appears at the end of the palette)
(4) Click "the red crossed circle" to delete the same color
(5) Krita crashes

Attached the kritacrash.log.
Comment 1 Halla Rempt 2018-02-27 09:51:03 UTC
Hi Peter,

I can reproduce the crash, but only on Windows.
Comment 2 mvowada 2018-02-27 11:39:30 UTC
Yes, I can confirm that on Ubuntu 14.04 with the latest Krita beta 4, it doesn't happen.
Comment 3 Halla Rempt 2018-06-04 10:14:14 UTC
*** Bug 395019 has been marked as a duplicate of this bug. ***
Comment 4 Halla Rempt 2018-06-04 10:19:16 UTC
I cannot reproduce this crash anymore, not even on Windows.
Comment 5 Antti Savolainen 2018-06-04 11:01:19 UTC
I can still reproduce it on Linux. I can't get a backtrace though because running gdb and causing this crash freezes my whole desktop. Linux is still fine as Ctrl+Alt+F1 works.

Installing the krita-testing from krita-lime (version: 4.0.0-0~201806031110~ubuntu17.10.1) doesn't crash but my self built version with symbols (version: 4.0.0-0~201804081023~ubuntu17.10.1) does crash.
Comment 6 Halla Rempt 2018-06-04 11:39:55 UTC
The trick to working with gdb when a crash happens in a popup window is to start gdb in a virtual terminal, attach to the running krita and then reproduce the bug. Back in the text terminal, gdb can then print a backtrace.
Comment 7 Antti Savolainen 2018-06-04 12:55:08 UTC
Thanks boud, that's a neat trick. Got the backtrace.

Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
0x00007ffff0fa23e8 in QScopedPointer<KoColorSet::Private, QScopedPointerDeleter<KoColorSet::Private> >::operator-> (this=0x20)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qscopedpointer.h:118
118	        return d;
(gdb) 
[K(gdb) bt
#0  0x00007ffff0fa23e8 in QScopedPointer<KoColorSet::Private, QScopedPointerDeleter<KoColorSet::Private> >::operator->() const (this=0x20) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qscopedpointer.h:118
#1  0x00007ffff0f91bec in KoColorSet::nColors() (this=0x0) at ./libs/pigment/resources/KoColorSet.cpp:283
#2  0x00007fffb7c90f90 in PaletteDockerDock::setColorSet(KoColorSet*) (this=0x55555fe4bb90, colorSet=0x0) at ./plugins/dockers/palettedocker/palettedocker_dock.cpp:181
#3  0x00007fffb7c90ebf in PaletteDockerDock::removingResource(KoColorSet*) (this=0x55555fe4bb90, resource=0x555556b46bd0) at ./plugins/dockers/palettedocker/palettedocker_dock.cpp:165
#4  0x00007ffff774144b in KoResourceServer<KoColorSet, PointerStoragePolicy<KoColorSet> >::notifyRemovingResource(KoColorSet*) (this=0x555556d388c0, resource=0x555556b46bd0) at ./libs/widgets/KoResourceServer.h:611
#5  0x00007ffff7760610 in KoResourceServer<KoColorSet, PointerStoragePolicy<KoColorSet> >::removeResourceAndBlacklist(KoColorSet*) (this=0x555556d388c0, resource=0x555556b46bd0) at ./libs/widgets/KoResourceServer.h:336
#6  0x00007ffff775fb33 in KoResourceServerAdapter<KoColorSet, PointerStoragePolicy<KoColorSet> >::removeResource(KoResource*) (this=0x55555fe83e60, resource=0x555556b46be0) at ./libs/widgets/KoResourceServerAdapter.h:179
#7  0x00007ffff1cab1de in KoResourceModel::removeResource(KoResource*) (this=0x55555fe8ac40, resource=0x555556b46be0) at ./libs/widgets/KoResourceModel.cpp:239
#8  0x00007ffff1ca5fac in KoResourceItemChooser::slotButtonClicked(int) (this=0x55555fe89c60, button=1) at ./libs/widgets/KoResourceItemChooser.cpp:221
#9  0x00007ffff1d18f06 in KoResourceItemChooser::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x55555fe89c60, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fffffffca70)
    at ./obj-x86_64-linux-gnu/libs/widgets/kritawidgets_autogen/EWIEGA46WW/moc_KoResourceItemChooser.cpp:121
#10 0x00007ffff50f28e5 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007ffff5f1c5c1 in QButtonGroup::buttonClicked(int) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff5ffa7e1 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff5ffbb6a in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff5ffbd54 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007ffff5e7edc8 in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff5e3e46c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff5e4628f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff76aa4f5 in KisApplication::notify(QObject*, QEvent*) (this=0x7fffffffd8f0, receiver=0x55555fea12d0, event=0x7fffffffcfb0) at ./libs/ui/KisApplication.cpp:652
#19 0x00007ffff50c3de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff5e45262 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff5e99685 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff5e9bfba in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff5e3e46c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff5e45d34 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff76aa4f5 in KisApplication::notify(QObject*, QEvent*) (this=0x7fffffffd8f0, receiver=0x555560a36230, event=0x7fffffffd440) at ./libs/ui/KisApplication.cpp:652
#26 0x00007ffff50c3de8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff5682f43 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#28 0x00007ffff5684a25 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007ffff565ccab in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007fffe264d5a0 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#31 0x00007fffec78ffb7 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007fffec7901f0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fffec79027c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff511c47f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#35 0x00007ffff50c1e3a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#36 0x00007ffff50cada4 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x0000555555849493 in main(int, char**) (argc=1, argv=0x7fffffffda78) at ./krita/main.cc:361
Comment 8 Halla Rempt 2018-06-04 13:07:37 UTC
Ha, that helps -- it shows where the crash happened. But since this was built from the krita lime sources, then that didn't include the patch that fixed the issue. 

In both master and krita/4.0 line 181 in palettedocker_dock.cpp is actually blank, and the check for a valid colorset is present.