Bug 211116

Summary: Applying cubism filter to a layer makes Krita crash happily
Product: [Applications] krita Reporter: sinozzuke <sinozzuke>
Component: GeneralAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: crash CC: cberger, halla, lambdae2
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: simple test file, there's nothing special in it really

Description sinozzuke 2009-10-19 19:11:50 UTC
Application that crashed: krita
Version of the application: 2.1 Beta 3
KDE Version: 4.3.2 (KDE 4.3.2)
Qt Version: 4.5.2
Operating System: Linux 2.6.28-15-generic x86_64
Distribution: Ubuntu 9.04

What I was doing when the application crashed:
1.- Draw something in one layer
2.- Open Filters
3.- Select Cubism filter
4.- Apply effect
5.- Krita happily crash.

 -- Backtrace:
Application: Krita (krita), signal: Segmentation fault
[Current thread is 0 (LWP 15066)]

Thread 3 (Thread 0x7fdc2a87e950 (LWP 15081)):
#0  KoMixColorsOpImpl<KoRgbTraits<unsigned char> >::mixColors (this=<value optimized out>, colors=0x7fdc2a87cac8, weights=0x7fdc2a87cb92, nColors=<value optimized out>, dst=0x7fdc24ff5414 "")
    at /home/sinozzuke/kde4/src/koffice/libs/pigment/KoMixColorsOpImpl.h:85
#1  0x00007fdc363bc3ae in KisCubismFilter::fillPolyColor (this=0xe07650, src={d = 0x7fdc2a87ce30}, srcTopLeft=<value optimized out>, dst={d = 0x7fdc2a87ce20}, dstTopLeft=<value optimized out>, 
    size=<value optimized out>, poly=0x7fdc25366bd0, col=0x4f48a70 "", dest=0x0) at /home/sinozzuke/kde4/src/koffice/krita/plugins/filters/cubismfilter/kis_cubism_filter.cpp:342
#2  0x00007fdc363bcee7 in KisCubismFilter::cubism (this=0xe07650, src={d = 0x7fdc2a87cf30}, srcTopLeft=@0x7fdc2a87cf80, dst={d = 0x7fdc2a87cf20}, dstTopLeft=@0x7fdc2a87cf90, size=@0x7fdc2a87d1a0, 
    tileSize=6, tileSaturation=<value optimized out>) at /home/sinozzuke/kde4/src/koffice/krita/plugins/filters/cubismfilter/kis_cubism_filter.cpp:421
#3  0x00007fdc363bda76 in KisCubismFilter::process (this=0xe07650, srcInfo={d = 0x7fdc2a87d190}, dstInfo=<value optimized out>, size=@0x7fdc2a87d1a0, configuration=<value optimized out>, 
    progressUpdater=<value optimized out>) at /home/sinozzuke/kde4/src/koffice/krita/plugins/filters/cubismfilter/kis_cubism_filter.cpp:108
#4  0x00007fdc56a8c079 in KisFilterMask::decorateRect (this=0x6da8590, src=<value optimized out>, dst=@0x7fdc2a87d3d0, rc=@0x7fdc2a87d510)
    at /home/sinozzuke/kde4/src/koffice/krita/image/kis_filter_mask.cpp:124
#5  0x00007fdc56aae26a in KisMask::apply (this=0x6da8590, projection={d = 0x7fdc2a87d5c0}, rc=@0x7fdc2a87d510) at /home/sinozzuke/kde4/src/koffice/krita/image/kis_mask.cc:114
#6  0x00007fdc56aab2b3 in KisLayer::applyMasks (this=0xc993c0, source=<value optimized out>, destination={d = 0x7fdc2a87d6a0}, requestedRect=<value optimized out>)
    at /home/sinozzuke/kde4/src/koffice/krita/image/kis_layer.cc:357
#7  0x00007fdc56aab7f5 in KisLayer::updateProjection (this=0xc993c0, rect=<value optimized out>) at /home/sinozzuke/kde4/src/koffice/krita/image/kis_layer.cc:417
#8  0x00007fdc56ad545c in KisImageUpdater::update (this=0x1fc1260, node={d = 0x7fdc2a87d830}, child={d = 0x7fdc2a87d820}, rc=<value optimized out>)
    at /home/sinozzuke/kde4/src/koffice/krita/image/kis_projection.cc:173
#9  0x00007fdc56ad57c3 in KisImageUpdater::startUpdate (this=0x1fc1260, node=<value optimized out>, rc=@0x4395900) at /home/sinozzuke/kde4/src/koffice/krita/image/kis_projection.cc:155
#10 0x00007fdc56ad5909 in KisImageUpdater::qt_metacall (this=0x1fc1260, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x1f4a810) at /home/sinozzuke/kde4/krita/image/kis_projection.moc:132
#11 0x00007fdc573515d8 in QObject::event (this=0x1fc1260, e=0x1f3b040) at kernel/qobject.cpp:1111
#12 0x00007fdc5093ef4d in QApplicationPrivate::notify_helper (this=0xa04c30, receiver=0x1fc1260, e=0x1f3b040) at kernel/qapplication.cpp:4056
#13 0x00007fdc5094718a in QApplication::notify (this=0x7fff5fa5ac70, receiver=0x1fc1260, e=0x1f3b040) at kernel/qapplication.cpp:4021
#14 0x00007fdc51d45abb in KApplication::notify (this=0x7fff5fa5ac70, receiver=0x1fc1260, event=0x1f3b040) at /build/buildd/kde4libs-4.3.2/kdeui/kernel/kapplication.cpp:302
#15 0x00007fdc573416ac in QCoreApplication::notifyInternal (this=0x7fff5fa5ac70, receiver=0x1fc1260, event=0x1f3b040) at kernel/qcoreapplication.cpp:610
#16 0x00007fdc5734231a in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0xc99a90) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#17 0x00007fdc5736e6f0 in QEventDispatcherUNIX::processEvents (this=0xf09700, flags={i = 713547696}) at kernel/qeventdispatcher_unix.cpp:876
#18 0x00007fdc5733ff42 in QEventLoop::processEvents (this=<value optimized out>, flags={i = 713547744}) at kernel/qeventloop.cpp:149
#19 0x00007fdc57340314 in QEventLoop::exec (this=0x7fdc2a87e020, flags={i = 713547824}) at kernel/qeventloop.cpp:201
#20 0x00007fdc57254dc8 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#21 0x00007fdc57257d35 in QThreadPrivate::start (arg=0x1f0e040) at thread/qthread_unix.cpp:188
#22 0x00007fdc4ea933ba in start_thread (arg=<value optimized out>) at pthread_create.c:297
#23 0x00007fdc4f679fcd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#24 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fdc29eec950 (LWP 15292)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007fdc57258d19 in QWaitCondition::wait (this=0x4c8bfc8, mutex=0x1fb97b0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  0x00007fdc4e1585e4 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x4c8bfa0, th=0x1fdfe30) at /build/buildd/kde4libs-4.3.2/threadweaver/Weaver/WeaverImpl.cpp:365
#3  0x00007fdc4e15ad93 in ThreadWeaver::WorkingHardState::applyForWork (this=0x1fed670, th=0x1fdfe30) at /build/buildd/kde4libs-4.3.2/threadweaver/Weaver/WorkingHardState.cpp:71
#4  0x00007fdc4e15930f in ThreadWeaver::ThreadRunHelper::run (this=0x7fdc29eec020, parent=0x4c8bfa0, th=0x1fdfe30) at /build/buildd/kde4libs-4.3.2/threadweaver/Weaver/Thread.cpp:87
#5  0x00007fdc4e159769 in ThreadWeaver::Thread::run (this=0x1fdfe30) at /build/buildd/kde4libs-4.3.2/threadweaver/Weaver/Thread.cpp:142
#6  0x00007fdc57257d35 in QThreadPrivate::start (arg=0x1fdfe30) at thread/qthread_unix.cpp:188
#7  0x00007fdc4ea933ba in start_thread (arg=<value optimized out>) at pthread_create.c:297
#8  0x00007fdc4f679fcd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fdc46b00790 (LWP 15066)):
[KCrash Handler]
#5  KisFilterDialog::apply (this=0x2872240) at /home/sinozzuke/kde4/src/koffice/krita/ui/dialogs/kis_dlg_filter.cpp:128
#6  0x00007fdc56e333f0 in KisFilterDialog::qt_metacall (this=0x2872240, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff5fa58740)
    at /home/sinozzuke/kde4/krita/ui/kis_dlg_filter.moc:77
#7  0x00007fdc57356ea2 in QMetaObject::activate (sender=0x2ad6c10, from_signal_index=<value optimized out>, to_signal_index=27, argv=0x1) at kernel/qobject.cpp:3113
#8  0x00007fdc50cba83e in QAbstractButtonPrivate::emitPressed (this=0x4664760) at widgets/qabstractbutton.cpp:557
#9  0x00007fdc50cbaa13 in QAbstractButton::mousePressEvent (this=0x2ad6c10, e=0x7fff5fa58f10) at widgets/qabstractbutton.cpp:1092
#10 0x00007fdc50990296 in QWidget::event (this=0x2ad6c10, event=0x7fff5fa58f10) at kernel/qwidget.cpp:7545
#11 0x00007fdc5093ef4d in QApplicationPrivate::notify_helper (this=0xa04c30, receiver=0x2ad6c10, e=0x7fff5fa58f10) at kernel/qapplication.cpp:4056
#12 0x00007fdc509478ea in QApplication::notify (this=<value optimized out>, receiver=0x2ad6c10, e=0x7fff5fa58f10) at kernel/qapplication.cpp:3758
#13 0x00007fdc51d45abb in KApplication::notify (this=0x7fff5fa5ac70, receiver=0x2ad6c10, event=0x7fff5fa58f10) at /build/buildd/kde4libs-4.3.2/kdeui/kernel/kapplication.cpp:302
#14 0x00007fdc573416ac in QCoreApplication::notifyInternal (this=0x7fff5fa5ac70, receiver=0x2ad6c10, event=0x7fff5fa58f10) at kernel/qcoreapplication.cpp:610
#15 0x00007fdc50946b38 in QApplicationPrivate::sendMouseEvent (receiver=0x2ad6c10, event=0x7fff5fa58f10, alienWidget=0x2ad6c10, nativeWidget=0x2872240, buttonDown=<value optimized out>, 
    lastMouseReceiver=@0x7fdc51376010) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:216
#16 0x00007fdc509b0b19 in QETWidget::translateMouseEvent (this=0x2872240, event=<value optimized out>) at kernel/qapplication_x11.cpp:4409
#17 0x00007fdc509afb53 in QApplication::x11ProcessEvent (this=0x7fff5fa5ac70, event=0x7fff5fa5aaa0) at kernel/qapplication_x11.cpp:3550
#18 0x00007fdc509d8e2f in QEventDispatcherX11::processEvents (this=0x9b0410, flags={i = 1604692912}) at kernel/qeventdispatcher_x11.cpp:132
#19 0x00007fdc5733ff42 in QEventLoop::processEvents (this=<value optimized out>, flags={i = 1604692960}) at kernel/qeventloop.cpp:149
#20 0x00007fdc57340314 in QEventLoop::exec (this=0x7fff5fa5ac20, flags={i = 1604693040}) at kernel/qeventloop.cpp:201
#21 0x00007fdc573425e4 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#22 0x00007fdc57638a55 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/sinozzuke/kde4/src/koffice/krita/main.cc:49
#23 0x00007fdc4f5b25a6 in __libc_start_main (main=0x4009c0 <main>, argc=1, ubp_av=0x7fff5fa5ae08, init=0x4009f0 <__libc_csu_init>, fini=<value optimized out>, rtld_fini=<value optimized out>, 
    stack_end=0x7fff5fa5adf8) at libc-start.c:220
#24 0x00000000004008f9 in _start () at ../sysdeps/x86_64/elf/start.S:113

Reported using DrKonqi
Comment 1 Halla Rempt 2009-10-19 21:05:39 UTC
I'm afraid I cannot reproduce with 8 bits rgb. Which colorspace/bit depth did you use and what image size?
Comment 2 Cyrille Berger 2009-10-20 09:20:54 UTC
"KoMixColorsOpImpl<KoRgbTraits<unsigned char> >::mixColors" would indicate RGB 8bit. If Gaizka used a different color space, then there is so misassumption in the cubism filter.
Comment 3 Halla Rempt 2009-10-20 09:37:42 UTC
I received Gaizka's file last night, and unfortunately, I cannot make it crash :-(
Comment 4 sinozzuke 2009-10-20 09:48:16 UTC
have you try decresing to 5 the cubes?

On Tue, Oct 20, 2009 at 9:37 AM, <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=211116
>
>
>
>
>
> --- Comment #3 from  <boud valdyas org>  2009-10-20 09:37:42 ---
> I received Gaizka's file last night, and unfortunately, I cannot make it
> crash
> :-(
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 5 Halla Rempt 2009-10-20 09:55:02 UTC
Yes... And that doesn't matter much. I see that the progress bar is broken, though.
Comment 6 Halla Rempt 2009-10-20 12:44:58 UTC
Memcheck doesn't give any hints either :-(
Comment 7 sinozzuke 2009-10-20 13:31:54 UTC
Perhaps is my instalation o my system configuration?

On Tue, Oct 20, 2009 at 12:45 PM, <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=211116
>
>
>
>
>
> --- Comment #6 from  <boud valdyas org>  2009-10-20 12:44:58 ---
> Memcheck doesn't give any hints either :-(
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 8 Elián Hanisch 2009-10-20 22:57:36 UTC
I can reproduce:
1. I start a 8bits rgb 1024x768 white image
2. add a new layer
3. draw something with the brush in the new layer, I just drew a zigzag line
4. open cubism filter dialog and hit "apply and close" with defaults values
5. sometimes it crashes, if doesn't, repeat from step 2

I'm using kubuntu 9.10 beta, kde 4.3.2 and qt 4.5.2

My backtrace doesn't seem the same though
(gdb) r
Starting program: /home/m4v/dev/kde/install/koffice/trunk/bin/krita
[Thread debugging using libthread_db enabled]
[Nuevo Thread 0xb25d8b70 (LWP 6589)]
X Error: BadAtom (invalid Atom parameter) 5
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x0
Enchant dict for "en_US" 0x8e08338
Enchant dict for "en_US" 0x8e08338
Enchant dict for "en_US" 0x8e08338
[Nuevo Thread 0xb1739b70 (LWP 6590)]
[Nuevo Thread 0xb0f38b70 (LWP 6591)]
[Thread 0xb0f38b70 (LWP 6591) terminado]
[Thread 0xb1739b70 (LWP 6590) terminado]
[Nuevo Thread 0xb1739b70 (LWP 6592)]
[Nuevo Thread 0xb0f38b70 (LWP 6593)]
[Nuevo Thread 0xb05ffb70 (LWP 6594)]
[Thread 0xb05ffb70 (LWP 6594) terminado]
[Thread 0xb1739b70 (LWP 6592) terminado]
[Thread 0xb0f38b70 (LWP 6593) terminado]
[Nuevo Thread 0xb0f38b70 (LWP 6595)]
[Thread 0xb0f38b70 (LWP 6595) terminado]
KisImage(0x8a763b8)
QLayout: Attempting to add QLayout "" to QWidget "KritaShape/KisToolBrushoption widget", which already has a layout
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QGridLayout: Multi-cell fromRow greater than toRow
[Nuevo Thread 0xb0f38b70 (LWP 6599)]
[Thread 0xb0f38b70 (LWP 6599) terminado]
[Nuevo Thread 0xb0f38b70 (LWP 6600)]

Program received signal SIGSEGV, Segmentation fault.
0x015ca011 in QWidget::setEnabled(bool) () from /usr/lib/libQtGui.so.4
(gdb) bt
#0  0x015ca011 in QWidget::setEnabled(bool) () from /usr/lib/libQtGui.so.4
#1  0x00195891 in KisFilterDialog::apply (this=0x91a4470) at /home/m4v/dev/kde/src/koffice/trunk/krita/ui/dialogs/kis_dlg_filter.cpp:128
#2  0x001964cb in KisFilterDialog::qt_metacall (this=0x91a4470, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbfffd6bc) at /home/m4v/dev/kde/build/koffice/trunk/krita/ui/kis_dlg_filter.moc:77
#3  0x0074f263 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQtCore.so.4
#4  0x0074fec2 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#5  0x01c00c67 in QAbstractButton::pressed() () from /usr/lib/libQtGui.so.4
#6  0x019290f9 in ?? () from /usr/lib/libQtGui.so.4
#7  0x019292f1 in QAbstractButton::mousePressEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#8  0x015c8ff6 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#9  0x019293ee in QAbstractButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#10 0x019d366d in QPushButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#11 0x01573f54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#12 0x0157c033 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#13 0x01293bfa in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#14 0x007396cb in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#15 0x0157af6e in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&) () from /usr/lib/libQtGui.so.4
#16 0x015e97c0 in ?? () from /usr/lib/libQtGui.so.4
#17 0x015e8c4b in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#18 0x01616050 in ?? () from /usr/lib/libQtGui.so.4
#19 0x00737c79 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#20 0x007380ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#21 0x0073a53f in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#22 0x01573dd7 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#23 0x009e6bfd in kdemain (argc=1, argv=0xbffff5b4) at /home/m4v/dev/kde/src/koffice/trunk/krita/main.cc:49
#24 0x0804886b in main (argc=1, argv=0xbffff5b4) at /home/m4v/dev/kde/build/koffice/trunk/krita/krita_dummy.cpp:3
Comment 9 Elián Hanisch 2009-10-20 23:08:05 UTC
Created attachment 37690 [details]
simple test file, there's nothing special in it really

open and apply cubism in the topmost layer, usually it doesn't crash the first time, but then just undo and try again (which usually success in crashing) 

it doesn't work with the "apply cubism again" option in the filter menu, always try with filter dialog
Comment 10 Elián Hanisch 2009-10-21 03:49:31 UTC
after some more testing, the crash is unrelated to cubism, I got the same backtrace with 3 different filters.
Comment 11 Cyrille Berger 2009-10-21 08:55:23 UTC
I think this happen when you apply the filter while the preview filter mask is still getting updated. And that the bug is more general than just cubism filter, I remember having a similar issue with the blur filter, not too long ago.

This part of the backtrace seems to confirm my intuition:

#3  0x00007fdc363bda76 in KisCubismFilter::process (this=0xe07650, srcInfo={d =
0x7fdc2a87d190}, dstInfo=<value optimized out>, size=@0x7fdc2a87d1a0,
configuration=<value optimized out>, 
    progressUpdater=<value optimized out>) at
/home/sinozzuke/kde4/src/koffice/krita/plugins/filters/cubismfilter/kis_cubism_filter.cpp:108
#4  0x00007fdc56a8c079 in KisFilterMask::decorateRect (this=0x6da8590,
src=<value optimized out>, dst=@0x7fdc2a87d3d0, rc=@0x7fdc2a87d510)
    at /home/sinozzuke/kde4/src/koffice/krita/image/kis_filter_mask.cpp:124
#5  0x00007fdc56aae26a in KisMask::apply (this=0x6da8590, projection={d =
0x7fdc2a87d5c0}, rc=@0x7fdc2a87d510) at
/home/sinozzuke/kde4/src/koffice/krita/image/kis_mask.cc:114
#6  0x00007fdc56aab2b3 in KisLayer::applyMasks (this=0xc993c0, source=<value
optimized out>, destination={d = 0x7fdc2a87d6a0}, requestedRect=<value
optimized out>)
    at /home/sinozzuke/kde4/src/koffice/krita/image/kis_layer.cc:357
#7  0x00007fdc56aab7f5 in KisLayer::updateProjection (this=0xc993c0,
rect=<value optimized out>) at
/home/sinozzuke/kde4/src/koffice/krita/image/kis_layer.cc:417

A possible fix would be to make sure the filter dialog cancel the preview and then wait for the preview to be done with filter mask.
Comment 12 Halla Rempt 2009-10-22 09:27:29 UTC
It's confirmed then.
Comment 13 Cyrille Berger 2010-02-27 09:36:36 UTC
Can't reproduce at the moment, but on the other filter do some strange things at the moment.
Comment 14 Halla Rempt 2010-03-04 10:33:29 UTC
SVN commit 1098752 by rempt:

Cubism filter: don't install

Still compile it, so it won't bitrot and will be ready for moving
to extensions after 2.1, but don't install it anymore since it doesn't
fit our purpose.

BUG:211116

 M  +2 -2      CMakeLists.txt  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1098752
Comment 15 Elián Hanisch 2010-03-04 11:33:12 UTC
the bug wasn't related to cubism, since I got the same crash with other filters...

but I can't reproduce anymore anyway