Bug 398459

Summary: Crash caused by color custimization
Product: [Applications] korganizer Reporter: Denis Kurz <kdenis>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: jv3303, s.zb
Priority: NOR Keywords: drkonqi
Version: 5.9.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 5.9.3
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Denis Kurz 2018-09-10 13:55:39 UTC
Application: korganizer (5.9.0)

Qt Version: 5.11.1
Frameworks Version: 5.50.0
Operating System: Linux 4.17.15-gentoo-r1 x86_64
Distribution (Platform): Gentoo Packages

-- Information about the crash:
- What I was doing when the application crashed:

In KOrganizer (standalone), I changed the color of TODO incidents that are due today, via [translated from German:] Settings -> Configure Korganizer -> Colors and Fonts. A click on Apply crashed the application. I reproduced it like this two more times, without doing anything else between starting KOrganizer and setting the color.

After each crash, the color that I last chose before the crash for due TODOs, so at least the new setting was saved.

The crash can be reproduced every time.

-- Backtrace:
Application: KOrganizer (korganizer), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fa6d73197c0 (LWP 5418))]

Thread 7 (Thread 0x7fa69d675700 (LWP 5922)):
#0  0x00007fa6caac87bd in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fa6c3e2cfb8 <QTWTF::pageheap_memory+57592>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fa6c3e2cf68 <QTWTF::pageheap_memory+57512>, cond=0x7fa6c3e2cf90 <QTWTF::pageheap_memory+57552>) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fa6c3e2cf90 <QTWTF::pageheap_memory+57552>, mutex=0x7fa6c3e2cf68 <QTWTF::pageheap_memory+57512>) at pthread_cond_wait.c:655
#3  0x00007fa6c3b38434 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7fa6c3e1eec0 <QTWTF::pageheap_memory>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#4  0x00007fa6c3b38479 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#5  0x00007fa6caac18ea in start_thread (arg=0x7fa69d675700) at pthread_create.c:465
#6  0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7fa69ff50700 (LWP 5439)):
#0  0x00007fa6caac87bd in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55abbd4ee3c0) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55abbd4ee370, cond=0x55abbd4ee398) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55abbd4ee398, mutex=0x55abbd4ee370) at pthread_cond_wait.c:655
#3  0x00007fa6a05e69cb in cnd_wait (mtx=0x55abbd4ee370, cond=0x55abbd4ee398) at /var/tmp/portage/media-libs/mesa-18.1.6/work/mesa-18.1.6/include/c11/threads_posix.h:155
#4  util_queue_thread_func (input=input@entry=0x55abbd97d060) at /var/tmp/portage/media-libs/mesa-18.1.6/work/mesa-18.1.6/src/util/u_queue.c:255
#5  0x00007fa6a05e66f7 in impl_thrd_routine (p=<optimized out>) at /var/tmp/portage/media-libs/mesa-18.1.6/work/mesa-18.1.6/include/c11/threads_posix.h:87
#6  0x00007fa6caac18ea in start_thread (arg=0x7fa69ff50700) at pthread_create.c:465
#7  0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7fa6b0ad1700 (LWP 5429)):
#0  0x00007fa6c8ca9909 in g_mutex_lock (mutex=mutex@entry=0x7fa6a8000bf0) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gthread-posix.c:1336
#1  0x00007fa6c8c64bb8 in g_main_context_iteration (context=0x7fa6a8000bf0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:4032
#2  0x00007fa6d373752b in QEventDispatcherGlib::processEvents (this=0x7fa6a8000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#3  0x00007fa6d36e353a in QEventLoop::exec (this=this@entry=0x7fa6b0ad0de0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:214
#4  0x00007fa6d3546c4a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:525
#5  0x00007fa6d355069f in QThreadPrivate::start (arg=0x55abbd460be0) at thread/qthread_unix.cpp:367
#6  0x00007fa6caac18ea in start_thread (arg=0x7fa6b0ad1700) at pthread_create.c:465
#7  0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7fa6b12d2700 (LWP 5424)):
#0  0x00007fa6d2bbc34a in __GI___libc_read (fd=<optimized out>, buf=buf@entry=0x7fa6b12d1bc0, nbytes=nbytes@entry=16) at ../sysdeps/unix/sysv/linux/read.c:26
#1  0x00007fa6c8ca85c0 in read (__nbytes=16, __buf=0x7fa6b12d1bc0, __fd=<optimized out>) at /usr/include/bits/unistd.h:44
#2  g_wakeup_acknowledge (wakeup=0x7fa6ac0039a0) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gwakeup.c:210
#3  0x00007fa6c8c6459b in g_main_context_check (context=context@entry=0x7fa6a4000bf0, max_priority=2147483647, fds=fds@entry=0x7fa6a406f880, n_fds=n_fds@entry=1) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3750
#4  0x00007fa6c8c64a60 in g_main_context_iterate (context=context@entry=0x7fa6a4000bf0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3969
#5  0x00007fa6c8c64bcc in g_main_context_iteration (context=0x7fa6a4000bf0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:4033
#6  0x00007fa6d373752b in QEventDispatcherGlib::processEvents (this=0x7fa6a4000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#7  0x00007fa6d36e353a in QEventLoop::exec (this=this@entry=0x7fa6b12d1de0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:214
#8  0x00007fa6d3546c4a in QThread::exec (this=<optimized out>) at thread/qthread.cpp:525
#9  0x00007fa6d355069f in QThreadPrivate::start (arg=0x55abbd421660) at thread/qthread_unix.cpp:367
#10 0x00007fa6caac18ea in start_thread (arg=0x7fa6b12d2700) at pthread_create.c:465
#11 0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fa6b297a700 (LWP 5423)):
#0  0x00007fa6d2bc0bf5 in __GI___poll (fds=0x7fa6ac01f350, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fa6c8c64ab9 in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0x7fa6ac01f350, timeout=<optimized out>, context=0x7fa6ac000bf0) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:4271
#2  g_main_context_iterate (context=context@entry=0x7fa6ac000bf0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3967
#3  0x00007fa6c8c64bcc in g_main_context_iteration (context=0x7fa6ac000bf0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:4033
#4  0x00007fa6d373752b in QEventDispatcherGlib::processEvents (this=0x7fa6ac000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#5  0x00007fa6d36e353a in QEventLoop::exec (this=this@entry=0x7fa6b2979db0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:214
#6  0x00007fa6d3546c4a in QThread::exec (this=this@entry=0x7fa6d22f8d60 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread.cpp:525
#7  0x00007fa6d2080de5 in QDBusConnectionManager::run (this=0x7fa6d22f8d60 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at qdbusconnection.cpp:178
#8  0x00007fa6d355069f in QThreadPrivate::start (arg=0x7fa6d22f8d60 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread_unix.cpp:367
#9  0x00007fa6caac18ea in start_thread (arg=0x7fa6b297a700) at pthread_create.c:465
#10 0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fa6b9104700 (LWP 5420)):
#0  0x00007fa6d2bc0bf5 in __GI___poll (fds=fds@entry=0x7fa6b9103ce8, nfds=nfds@entry=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fa6c87f77f7 in poll (__timeout=-1, __nfds=1, __fds=0x7fa6b9103ce8) at /usr/include/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0x55abbd2faa90, cond=cond@entry=0x55abbd2faad0, vector=vector@entry=0x0, count=count@entry=0x0) at /var/tmp/portage/x11-libs/libxcb-1.13/work/libxcb-1.13/src/xcb_conn.c:479
#3  0x00007fa6c87f940a in xcb_wait_for_event (c=0x55abbd2faa90) at /var/tmp/portage/x11-libs/libxcb-1.13/work/libxcb-1.13/src/xcb_in.c:697
#4  0x00007fa6bb04a9c9 in QXcbEventReader::run (this=0x55abbd2fa730) at qxcbconnection.cpp:1388
#5  0x00007fa6d355069f in QThreadPrivate::start (arg=0x55abbd2fa730) at thread/qthread_unix.cpp:367
#6  0x00007fa6caac18ea in start_thread (arg=0x7fa6b9104700) at pthread_create.c:465
#7  0x00007fa6d2bcc61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fa6d73197c0 (LWP 5418)):
[KCrash Handler]
#6  std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x18) at /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/g++-v7/bits/atomic_base.h:396
#7  QAtomicOps<int>::load<int> (_q_value=...) at ../../include/QtCore/../../src/corelib/thread/qatomic_cxx11.h:227
#8  QBasicAtomicInteger<int>::load (this=0x18) at ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:103
#9  QtPrivate::RefCount::ref (this=0x18) at ../../include/QtCore/../../src/corelib/tools/qrefcount.h:55
#10 0x00007fa6d36a28e4 in QVector<QPersistentModelIndexData*>::QVector (this=0x7ffc0a3b3800, v=...) at ../../include/QtCore/../../src/corelib/tools/qvector.h:358
#11 0x00007fa6d36a371a in QStack<QVector<QPersistentModelIndexData*> >::pop (this=this@entry=0x55abbecd6e20) at ../../include/QtCore/../../src/corelib/tools/qstack.h:62
#12 0x00007fa6d369d262 in QAbstractItemModelPrivate::itemsMoved (this=this@entry=0x55abbecd6da0, sourceParent=..., sourceFirst=sourceFirst@entry=24, sourceLast=sourceLast@entry=0, destinationParent=..., destinationChild=destinationChild@entry=2, orientation=Qt::Vertical) at itemmodels/qabstractitemmodel.cpp:799
#13 0x00007fa6d36a038d in QAbstractItemModel::endMoveRows (this=this@entry=0x55abbecd6c60) at itemmodels/qabstractitemmodel.cpp:2966
#14 0x00007fa6cfa22687 in Akonadi::TagModelPrivate::monitoredTagChanged (this=0x55abbecd6e50, tag=...) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/models/tagmodel_p.cpp:208
#15 0x00007fa6cfa1fc7d in Akonadi::TagModel::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1_build/src/core/KF5AkonadiCore_autogen/include/moc_tagmodel.cpp:109
#16 0x00007fa6d370dc23 in QMetaObject::activate (sender=0x55abbecd55e0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=22, argv=argv@entry=0x7ffc0a3b3ba0) at kernel/qobject.cpp:3771
#17 0x00007fa6d370e297 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7fa6cfc9a9a0 <Akonadi::Monitor::staticMetaObject>, local_signal_index=local_signal_index@entry=22, argv=argv@entry=0x7ffc0a3b3ba0) at kernel/qobject.cpp:3633
#18 0x00007fa6cf937fd5 in Akonadi::Monitor::tagChanged (this=<optimized out>, _t1=...) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1_build/src/core/KF5AkonadiCore_autogen/include/moc_monitor.cpp:1051
#19 0x00007fa6cf93dc74 in Akonadi::MonitorPrivate::emitTagNotification (this=this@entry=0x55abbe2af080, msg=..., tag=...) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/monitor_p.cpp:1237
#20 0x00007fa6cf9453a6 in Akonadi::MonitorPrivate::emitNotification (this=0x55abbe2af080, msg=...) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/monitor_p.cpp:515
#21 0x00007fa6cf943e2c in Akonadi::MonitorPrivate::dispatchNotifications (this=this@entry=0x55abbe2af080) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/monitor_p.cpp:1003
#22 0x00007fa6cf943fd9 in Akonadi::MonitorPrivate::slotNotify (this=0x55abbe2af080, msg=...) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/monitor_p.cpp:972
#23 0x00007fa6cf946517 in Akonadi::MonitorPrivate::handleCommands (this=0x55abbe2af080) at /var/tmp/portage/kde-apps/akonadi-18.08.1/work/akonadi-18.08.1/src/core/monitor_p.cpp:867
#24 0x00007fa6d370e96a in QObject::event (this=0x55abbecd55e0, e=<optimized out>) at kernel/qobject.cpp:1251
#25 0x00007fa6d4629e0c in QApplicationPrivate::notify_helper (this=this@entry=0x55abbd2eb810, receiver=receiver@entry=0x55abbecd55e0, e=e@entry=0x7fa6a4091ba0) at kernel/qapplication.cpp:3727
#26 0x00007fa6d46313af in QApplication::notify (this=0x7ffc0a3b45b0, receiver=0x55abbecd55e0, e=0x7fa6a4091ba0) at kernel/qapplication.cpp:3486
#27 0x00007fa6d36e4747 in QCoreApplication::notifyInternal2 (receiver=0x55abbecd55e0, event=event@entry=0x7fa6a4091ba0) at kernel/qcoreapplication.cpp:1048
#28 0x00007fa6d36e75a1 in QCoreApplication::sendEvent (event=0x7fa6a4091ba0, receiver=<optimized out>) at kernel/qcoreapplication.h:234
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55abbd2e7a90) at kernel/qcoreapplication.cpp:1745
#30 0x00007fa6d36e7b18 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1599
#31 0x00007fa6d3737723 in postEventSourceDispatch (s=s@entry=0x55abbd376530) at kernel/qeventdispatcher_glib.cpp:276
#32 0x00007fa6c8c64907 in g_main_dispatch (context=0x7fa6b4004ff0) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3234
#33 g_main_context_dispatch (context=context@entry=0x7fa6b4004ff0) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3899
#34 0x00007fa6c8c64b38 in g_main_context_iterate (context=context@entry=0x7fa6b4004ff0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:3972
#35 0x00007fa6c8c64bcc in g_main_context_iteration (context=0x7fa6b4004ff0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.52.3/work/glib-2.52.3/glib/gmain.c:4033
#36 0x00007fa6d373750f in QEventDispatcherGlib::processEvents (this=0x55abbd376db0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#37 0x00007fa6bb0d2e71 in QPAEventDispatcherGlib::processEvents (this=0x55abbd376db0, flags=...) at qeventdispatcher_glib.cpp:69
#38 0x00007fa6d36e353a in QEventLoop::exec (this=this@entry=0x7ffc0a3b44d0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:214
#39 0x00007fa6d36ebf20 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1336
#40 0x000055abbc66eefc in main (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-apps/korganizer-18.08.0/work/korganizer-18.08.0/src/main.cpp:64

Possible duplicates by query: bug 384419, bug 383217, bug 374945, bug 372712, bug 366422.

Reported using DrKonqi
Comment 1 Stefan Zurucker 2018-10-11 11:35:08 UTC
Created attachment 115562 [details]
New crash information added by DrKonqi

korganizer (5.9.1) using Qt 5.11.1

- What I was doing when the application crashed: In KOrganizer, I changed the color of an event category via Settings > Configure KOrganizer > Colors and Fonts. When I clicked 'Apply' it crashed the application, telling me that it closed unexpectedly. I was able to reproduce this behaviour three more times immediately after. 

It appears that KOrganizer crashes every time when I'm doing this. It does however save the new category color and I can apply it to my events just fine.

- Custom settings of the application:
I did change the location of my .ics-file and put it in my Spideroak-folder within my Home folder (Spideroak being a Dropbox-like cloud syncing program), in order to have a synchronized version of my calendar on multiple devices.

-- Backtrace (Reduced):
#6  std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x18) at /usr/include/c++/7/bits/atomic_base.h:396
#7  QAtomicOps<int>::load<int> (_q_value=...) at ../../include/QtCore/../../src/corelib/thread/qatomic_cxx11.h:227
#8  QBasicAtomicInteger<int>::load (this=0x18) at ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:103
[...]
#10 0x00007f77e4e0e2d4 in QVector<QPersistentModelIndexData*>::QVector (this=0x7ffc5ad51fd0, v=...) at ../../include/QtCore/../../src/corelib/tools/qvector.h:358
#11 0x00007f77e4e0ef8a in QStack<QVector<QPersistentModelIndexData*> >::pop (this=this@entry=0x560ce043a670) at ../../include/QtCore/../../src/corelib/tools/qstack.h:62
Comment 2 Denis Kurz 2018-10-11 14:06:49 UTC
This will hopefully be fixed in version 5.9.3 due to this:

https://phabricator.kde.org/D16051
Comment 3 Denis Kurz 2018-10-11 21:23:48 UTC
Git commit 9d83f0752828942789535b1d0dc0ddc3c8b479bd by Denis Kurz.
Committed on 11/10/2018 at 21:23.
Pushed by dkurz into branch 'Applications/18.08'.

Fix KOrg category color customization crash

Summary:
Use default value for NULL columns.

Without this patch, possibly different default values are used for
entity construction (default from akonadidb.xml) and when reading a row
from the database (default-constructed), resulting in inconsistencies.
For example, when modifying a Tag, the resulting Tag modify notification
indicates that the new parentId of the modified Tag is 0
(default-constructed qint64), whereas Tags without parents are
initialized with parentId -1. This patch fixes these inconsistencies by
considering the "default" value from akonadidb.xml for row-to-entity
conversion, too.

Set default Tag::parentId to -1.

A parentless Tag is initialized with parentId -1, so we should also
report that when reading a Tag from the database where the parentId
field is NULL.
FIXED-IN: 5.9.3

Test Plan:
KOrganizer stops crashing on category color customization
with this patch. More detailed test plan suggestions welcome.

Reviewers: #kde_pim, dvratil

Reviewed By: #kde_pim, dvratil

Subscribers: dvratil, kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D16051

M  +2    -2    src/server/storage/akonadidb.xml
M  +1    -1    src/server/storage/entities.xsl

https://commits.kde.org/akonadi/9d83f0752828942789535b1d0dc0ddc3c8b479bd
Comment 4 Christoph Feck 2019-04-25 19:20:53 UTC
*** Bug 400220 has been marked as a duplicate of this bug. ***