Bug 277888

Summary: Color Transfer Effects crash
Product: krita Reporter: sinozzuke <sinozzuke>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: cberger, halla
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description sinozzuke 2011-07-16 12:33:35 UTC
Application: krita (2.4 Alpha 3)
KDE Platform Version: 4.6.2 (4.6.2)
Qt Version: 4.7.2
Operating System: Linux 2.6.38-10-generic x86_64
Distribution: KXStudio 11.04

-- Information about the crash:
- What I was doing when the application crashed:
1- Import an image as layer
2- Select all
3- Menu Effects. Select Color
4- Transfer color. Select a reference image.
5- crash

-- Backtrace:
Application: Krita (kdeinit4), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f2e7a657780 (LWP 14426))]

Thread 11 (Thread 0x7f2e54c6d700 (LWP 14430)):
#0  0x00007f2e77f2a143 in select () at ../sysdeps/unix/syscall-template.S:82
#1  0x00007f2e7930a32c in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e7930f3d0 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib/libQtCore.so.4
#3  0x00007f2e7931004a in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f2e792e1882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f2e792e1abc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f2e791f8924 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f2e792c3c2f in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f2e759fbd8c in start_thread (arg=0x7f2e54c6d700) at pthread_create.c:304
#10 0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7f2e5546e700 (LWP 14431)):
#0  0xffffffffff60017b in ?? ()
#1  0x00007f2e5546daf0 in ?? ()
#2  0x00007fff6bdfb7b2 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 9 (Thread 0x7f2e4ffff700 (LWP 14440)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f2e791fb82b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e791f8235 in QSemaphore::acquire(int) () from /usr/lib/libQtCore.so.4
#3  0x00007f2e66f0dd3e in KisTileDataPooler::waitForWork (this=0x4e67e70) at /home/sinozzuke/kde4/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:162
#4  0x00007f2e66f0e424 in KisTileDataPooler::run (this=0x4e67e70) at /home/sinozzuke/kde4/src/calligra/krita/image/tiles3/kis_tile_data_pooler.cc:184
#5  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#6  0x00007f2e759fbd8c in start_thread (arg=0x7f2e4ffff700) at pthread_create.c:304
#7  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#8  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7f2e47e0b700 (LWP 14441)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f2e791fb82b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e791f8469 in QSemaphore::tryAcquire(int, int) () from /usr/lib/libQtCore.so.4
#3  0x00007f2e66f2ec7a in KisTileDataSwapper::run (this=0x4e67ea8) at /home/sinozzuke/kde4/src/calligra/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#4  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#5  0x00007f2e759fbd8c in start_thread (arg=0x7f2e47e0b700) at pthread_create.c:304
#6  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7f2e46608700 (LWP 14450)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x00007f2e3f7873fc in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#2  0x00007f2e3f18cd08 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#3  0x00007f2e3f18cbcd in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#4  0x00007f2e759fbd8c in start_thread (arg=0x7f2e46608700) at pthread_create.c:304
#5  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7f2e45e07700 (LWP 14451)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x00007f2e3f7873fc in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#2  0x00007f2e3f18cd08 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#3  0x00007f2e3f18cbcd in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#4  0x00007f2e759fbd8c in start_thread (arg=0x7f2e45e07700) at pthread_create.c:304
#5  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7f2e3b315700 (LWP 15025)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007f2e791fb79e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e791f0218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f2e759fbd8c in start_thread (arg=0x7f2e3b315700) at pthread_create.c:304
#5  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f2e4760a700 (LWP 15026)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007f2e791fb79e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e791f0218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f2e759fbd8c in start_thread (arg=0x7f2e4760a700) at pthread_create.c:304
#5  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f2e39f74700 (LWP 15029)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f2e791fb82b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e6922e0b4 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f2e69230723 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f2e6922f53f in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f2e6922f5cb in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#6  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007f2e759fbd8c in start_thread (arg=0x7f2e39f74700) at pthread_create.c:304
#8  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f2e39773700 (LWP 15030)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f2e791fb82b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f2e6922e0b4 in ?? () from /usr/lib/libthreadweaver.so.4
#3  0x00007f2e69230723 in ?? () from /usr/lib/libthreadweaver.so.4
#4  0x00007f2e6922f53f in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x00007f2e6922f5cb in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#6  0x00007f2e791fb175 in ?? () from /usr/lib/libQtCore.so.4
#7  0x00007f2e759fbd8c in start_thread (arg=0x7f2e39773700) at pthread_create.c:304
#8  0x00007f2e77f3204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f2e7a657780 (LWP 14426)):
[KCrash Handler]
#6  0x00007f2e792e8287 in QMetaObject::cast(QObject*) const () from /usr/lib/libQtCore.so.4
#7  0x00007f2e65c381b4 in qobject_cast<KoResourceManager*> (this=0xb06230, obj=<value optimized out>) at /usr/include/qt4/QtCore/qobject.h:366
#8  KoShapeFactoryBase::pruneDocumentResourceManager (this=0xb06230, obj=<value optimized out>) at /home/sinozzuke/kde4/src/calligra/libs/flake/KoShapeFactoryBase.cpp:242
#9  0x00007f2e65bf7830 in KoShapeFactoryBase::qt_metacall (this=0xb06230, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7f2e5038b9b0) at /home/sinozzuke/kde4/build/calligra/libs/flake/moc_KoShapeFactoryBase.cpp:73
#10 0x00007f2e792f649a in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#11 0x00007f2e7869f9f4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#12 0x00007f2e786a43ba in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#13 0x00007f2e7a05d866 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#14 0x00007f2e792e249c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#15 0x00007f2e792e5c25 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#16 0x00007f2e7874a0ed in ?? () from /usr/lib/libQtGui.so.4
#17 0x00007f2e792e1882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#18 0x00007f2e792e1abc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#19 0x00007f2e792e5ecb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#20 0x00007f2e67819685 in kdemain (argc=<value optimized out>, argv=0x807fd0) at /home/sinozzuke/kde4/src/calligra/krita/main.cc:49
#21 0x0000000000406dd3 in _start ()

Reported using DrKonqi
Comment 1 Halla Rempt 2011-07-16 14:27:00 UTC
Ack:

[KCrash Handler]
#6  0x0000000000000000 in ?? ()
#7  0x00007fbdf5964349 in QMetaObject::cast (this=0x7fbdf24786c0, obj=0x7fbdcd055a60) at kernel/qmetaobject.cpp:266
#8  0x00007fbdf21d6b14 in qobject_cast<KoResourceManager*> (object=<optimized out>) at /usr/include/QtCore/qobject.h:366
#9  KoShapeFactoryBase::pruneDocumentResourceManager (this=0xb4d240, obj=<optimized out>) at /home/boud/kde/src/calligra/libs/flake/KoShapeFactoryBase.cpp:242
#10 0x00007fbdf218edd0 in KoShapeFactoryBase::qt_metacall (this=0xb4d240, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fbdc06db470) at /home/boud/kde/build/calligra/libs/flake/moc_KoShapeFactoryBase.cpp:73
#11 0x00007fbdf59723ca in QObject::event (this=0xb4d240, e=<optimized out>) at kernel/qobject.cpp:1217
#12 0x00007fbdee8740a4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#13 0x00007fbdee87c65a in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#14 0x00007fbdef4db346 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#15 0x00007fbdf595e40c in QCoreApplication::notifyInternal (this=0x7fff686bd740, receiver=0xb4d240, event=0x7fbdc08e8660) at kernel/qcoreapplication.cpp:787
#16 0x00007fbdf5961c05 in sendEvent (event=0x7fbdc08e8660, receiver=0xb4d240) at kernel/qcoreapplication.h:215
#17 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x60b400) at kernel/qcoreapplication.cpp:1428
#18 0x00007fbdf598c2f0 in QEventDispatcherUNIX::processEvents (this=0x610e10, flags=...) at kernel/qeventdispatcher_unix.cpp:904
#19 0x00007fbdee91ab9c in ?? () from /usr/lib64/libQtGui.so.4
#20 0x00007fbdf595d862 in QEventLoop::processEvents (this=<optimized out>, flags=...) at kernel/qeventloop.cpp:149
#21 0x00007fbdf595da75 in QEventLoop::exec (this=0x7fff686bd6f0, flags=...) at kernel/qeventloop.cpp:201
#22 0x00007fbdf5961ebb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1064
#23 0x00007fbdf5c964b5 in kdemain (argc=<optimized out>, argv=<optimized out>) at /home/boud/kde/src/calligra/krita/main.cc:49
#24 0x00007fbded272bfd in __libc_start_main () from /lib64/libc.so.6
#25 0x0000000000400929 in _start () at ../sysdeps/x86_64/elf/start.S:113
Comment 2 Halla Rempt 2011-07-16 15:05:41 UTC
Tricky one this. The color transfer filter imports/loads the image in the process methods. Since we try to process the filter in chunks for the preview, we try to load and delete the image many times in different threads -- and that's not going to work. The filter should probably be rewritten to store the image itself in the settings and pass that to the process method.
Comment 3 Cyrille Berger 2011-07-16 15:34:59 UTC
actually, all you need to store is the mean and sigma of L,a,b channels of the reference image. And compute them only once when opening the image in the filter widget.
Comment 4 Halla Rempt 2011-07-18 09:26:34 UTC
Git commit 0a3fa8fb560dc983bf682fe1f4680747ebb45f47 by Boudewijn Rempt.
Committed on 18/07/2011 at 11:14.
Pushed by rempt into branch 'master'.

FastColorTransfer: compute mean and sigma and store those in the config

We used to compute mean and sigma for the reference image in the
process(). This is wasteful, so compute those only once and store the
values in the config object.

BUG:277888

M  +17   -62   krita/plugins/filters/fastcolortransfer/fastcolortransfer.cpp
M  +87   -5    krita/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.cpp

http://commits.kde.org/calligra/0a3fa8fb560dc983bf682fe1f4680747ebb45f47