Bug 273858

Summary: Color to alpha filter : Doesn't work and/or crash somtime
Product: [Applications] krita Reporter: David REVOY <info>
Component: GeneralAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: halla
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description David REVOY 2011-05-22 17:26:33 UTC
Version:           svn trunk
OS:                Linux

The filter 'Color to Alpha' is precious for me ; it's allow me to remove the white of paper from a B&W scanned drawing. Actually the filter doesn't tranform the slected color in alpha , and worst ; it leads sometimes to crash ; here are the infos : 


Application: Krita (krita), signal: Segmentation fault
[Current thread is 1 (Thread 0xb6258740 (LWP 26584))]

Thread 9 (Thread 0xb3dffb70 (LWP 26588)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c015 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x00803997 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007ff372 in QSemaphore::acquire(int) () from /usr/lib/libQtCore.so.4
#4  0x00481603 in KisTileDataPooler::waitForWork (this=0x8f57790) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/tiles3/kis_tile_data_pooler.cc:162
#5  0x00481af3 in KisTileDataPooler::run (this=0x8f57790) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/tiles3/kis_tile_data_pooler.cc:184
#6  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#7  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 8 (Thread 0xb4701b70 (LWP 26589)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c015 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x00803997 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007ff172 in QSemaphore::tryAcquire(int, int) () from /usr/lib/libQtCore.so.4
#4  0x0049f160 in KisTileDataSwapper::waitForWork (this=0x8f577b0) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#5  0x0049f1a4 in KisTileDataSwapper::run (this=0x8f577b0) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#6  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#7  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 7 (Thread 0xb1bffb70 (LWP 26623)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c342 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0080391f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007f76ab in ?? () from /usr/lib/libQtCore.so.4
#4  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#5  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 6 (Thread 0xb35feb70 (LWP 26624)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c342 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0080391f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007f76ab in ?? () from /usr/lib/libQtCore.so.4
#4  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#5  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 5 (Thread 0xa418db70 (LWP 26625)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c342 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0080391f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007f76ab in ?? () from /usr/lib/libQtCore.so.4
#4  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#5  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 4 (Thread 0xa398cb70 (LWP 26626)):
#0  0x00ab2422 in __kernel_vsyscall ()
#1  0x0013c342 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x0080391f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#3  0x007f76ab in ?? () from /usr/lib/libQtCore.so.4
#4  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#5  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6  0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 3 (Thread 0x949ffb70 (LWP 26627)):
[KCrash Handler]
#6  0x03c9402b in cmsDoTransform () from /usr/lib/liblcms.so.1
#7  0x13f0d170 in ?? ()
#8  0x03f3666f in LcmsColorSpace<KoRgbU8Traits>::difference (this=0x1, src1=0x13c2ebb8 "\377\377\377\377\320\212\221\027\020", 
    src2=0x151a5320 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"...) at /home/deevad/source-to-compile/krita/calligra/calligra-src/plugins/colorengines/lcms/LcmsColorSpace.h:364
#9  0x02db5838 in KisFilterColorToAlpha::process (this=0x86f6f70, device=..., rect=..., config=0x143cbee0, progressUpdater=0xc93ac40)
    at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/plugins/filters/colors/kis_color_to_alpha.cpp:91
#10 0x004d7dcc in KisFilter::process (this=0x86f6f70, src=..., dst=..., sel=..., applyRect=..., config=0x143cbee0, progressUpdater=0xc93ac40)
    at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/filter/kis_filter.cc:110
#11 0x004db3ac in KisFilterJob::run (this=0xc93ad38) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/filter/kis_filter_job.cpp:66
#12 0x0174b49d in ?? () from /usr/lib/libthreadweaver.so.4
#13 0x0174b801 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#14 0x0174a4ea in ?? () from /usr/lib/libthreadweaver.so.4
#15 0x0174ac3b in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#16 0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#17 0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#18 0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 2 (Thread 0x941feb70 (LWP 26628)):
#0  0x03f366e4 in LcmsColorSpace<KoRgbU8Traits>::difference (this=0x13f0d170, src1=0x999c7580 "\377\377\377\377@", 
    src2=0x1555dfc4 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377kkk\377\004\004\004\377\001\001\001\377") at /home/deevad/source-to-compile/krita/calligra/calligra-src/plugins/colorengines/lcms/LcmsColorSpace.h:372
#1  0x02db5838 in KisFilterColorToAlpha::process (this=0x86f6f70, device=..., rect=..., config=0x143cbee0, progressUpdater=0xcc761e8)
    at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/plugins/filters/colors/kis_color_to_alpha.cpp:91
#2  0x004d7dcc in KisFilter::process (this=0x86f6f70, src=..., dst=..., sel=..., applyRect=..., config=0x143cbee0, progressUpdater=0xcc761e8)
    at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/filter/kis_filter.cc:110
#3  0x004db3ac in KisFilterJob::run (this=0xcc76390) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/image/filter/kis_filter_job.cpp:66
#4  0x0174b49d in ?? () from /usr/lib/libthreadweaver.so.4
#5  0x0174b801 in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#6  0x0174a4ea in ?? () from /usr/lib/libthreadweaver.so.4
#7  0x0174ac3b in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#8  0x0080297e in ?? () from /usr/lib/libQtCore.so.4
#9  0x0013796e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#10 0x015eaa4e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb6258740 (LWP 26584)):
#0  0x015f7df4 in ?? () from /lib/tls/i686/cmov/libc.so.6
#1  0x015dcb70 in poll () from /lib/tls/i686/cmov/libc.so.6
#2  0x01a27d60 in ?? () from /usr/lib/libxcb.so.1
#3  0x01a282cb in ?? () from /usr/lib/libxcb.so.1
#4  0x01a28667 in xcb_writev () from /usr/lib/libxcb.so.1
#5  0x063c3d79 in _XSend () from /usr/lib/libX11.so.6
#6  0x063c3f10 in _XReply () from /usr/lib/libX11.so.6
#7  0x063a0739 in XGetImage () from /usr/lib/libX11.so.6
#8  0x01f40228 in QX11PixmapData::toImage() const () from /usr/lib/libQtGui.so.4
#9  0x01f25c9b in QPixmap::toImage() const () from /usr/lib/libQtGui.so.4
#10 0x02165c8a in QCommonStyle::generatedIconPixmap(QIcon::Mode, QPixmap const&, QStyleOption const*) const () from /usr/lib/libQtGui.so.4
#11 0x076a95fe in KStyle::generatedIconPixmap(QIcon::Mode, QPixmap const&, QStyleOption const*) const () from /usr/lib/libkdeui.so.5
#12 0x02291a16 in QLabel::paintEvent(QPaintEvent*) () from /usr/lib/libQtGui.so.4
#13 0x01e8e016 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#14 0x0228c423 in QFrame::event(QEvent*) () from /usr/lib/libQtGui.so.4
#15 0x0229047a in QLabel::event(QEvent*) () from /usr/lib/libQtGui.so.4
#16 0x01e2fe8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#17 0x01e36aa9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#18 0x0769b40a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#19 0x0090013b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#20 0x01e97306 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/libQtGui.so.4
#21 0x01e98145 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#22 0x01e97f7e in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#23 0x01e97f7e in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#24 0x01e97f7e in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#25 0x01e97f7e in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#26 0x01e97055 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/libQtGui.so.4
#27 0x01e98145 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/libQtGui.so.4
#28 0x01e97055 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/libQtGui.so.4
#29 0x0206f080 in ?? () from /usr/lib/libQtGui.so.4
#30 0x01e87ae3 in QWidgetPrivate::syncBackingStore() () from /usr/lib/libQtGui.so.4
#31 0x01e8e7d6 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#32 0x022ab187 in QMainWindow::event(QEvent*) () from /usr/lib/libQtGui.so.4
#33 0x0778d2e4 in KMainWindow::event(QEvent*) () from /usr/lib/libkdeui.so.5
#34 0x077d50ff in KXmlGuiWindow::event(QEvent*) () from /usr/lib/libkdeui.so.5
#35 0x01e2fe8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#36 0x01e36aa9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#37 0x0769b40a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#38 0x0090013b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#39 0x00903bfc in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#40 0x0092f6fa in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#41 0x01ef0e82 in ?? () from /usr/lib/libQtGui.so.4
#42 0x008fe759 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0x008febaa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#44 0x00903e3f in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#45 0x01e2ff27 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#46 0x00df47ad in kdemain (argc=1, argv=0xbff86974) at /home/deevad/source-to-compile/krita/calligra/calligra-src/krita/main.cc:49
#47 0x0804884b in main (argc=1, argv=0xbff86974) at /home/deevad/source-to-compile/krita/calligra/calligra-build/krita/krita_dummy.cpp:3


Reproducible: Didn't try
Comment 1 Halla Rempt 2011-05-26 23:01:02 UTC
Looks a bit like a race condition. Dmitry?
Comment 2 Halla Rempt 2011-10-16 13:44:39 UTC
Hrm. This is a crash bug to start with. But I cannot reproduce. Also, David, what do you mean with "Actually the filter doesn't tranform
the slected color in alpha"? For me it seems to work for that. What I usually do when removing a scanned white background is select-by-color, ctrl-x, but this filter should work. The gui also is kind of bad, it should work with an eye-dropper tool on the canvas. The backtrace still suggests a race condition, and this line is suggestive:

#8  0x03f3666f in LcmsColorSpace<KoRgbU8Traits>::difference (this=0x1,

Apparently the pointer to the colorspace is 0x1???
Comment 3 Halla Rempt 2011-10-16 13:47:33 UTC
Hm! Looking at the source suggests that I cannot reproduce because the filter was fixed in 

From 49d808de615baea048624274954e18a67ef9d451 Mon Sep 17 00:00:00 2001
From: Cyrille Berger <cyb@lepi.org>
Date: Fri, 1 Oct 2010 19:45:35 +0000
Subject: [PATCH] do not raise the opacity of a pixel, this makes the filter
 more usefull on transparent layers

also copy the content from src to dst, it makes it looks better when used as a mask, but for some reason, no transparency is visible