Bug 333142

Summary: Krita crashes when generating random noise with filter
Product: [Applications] krita Reporter: Spencer Brown <sbrown655>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: halla
Priority: NOR    
Version: 2.9 Beta   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: attachment-20772-0.html
attachment-20772-1.dat
noisefiltercrash.patch
noisefilter.cpp

Description Spencer Brown 2014-04-07 02:41:51 UTC
Application: krita (2.9 Pre-Alpha (git c0faa1d))
KDE Platform Version: 4.8.5 (4.8.5)
Qt Version: 4.8.1
Operating System: Linux 3.11.0-15-generic x86_64
Distribution: Ubuntu 12.04.4 LTS

-- Information about the crash:
Steps to reproduce:

- Open an image
- Go to Filter->Other->Random Noise
- Click it
- Segfault

I have Krita compiled from sources against kdelibs that ship with Ubuntu 12.04. I'll try installing a more recent KDE PPA and see if the situation improves. If so, we probably don't need to do anything.

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fef080c17c0 (LWP 14717))]

Thread 13 (Thread 0x7feef0f6f700 (LWP 14720)):
#0  0x00007fef079c0a43 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007feefeecfff6 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007feefeed045a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007feef15d498b in ?? () from /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so
#4  0x00007feefeef19b5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 12 (Thread 0x7feeebfff700 (LWP 14721)):
#0  0x00007fef079c0a43 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007feefeecfff6 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007feefeed045a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007feef3ce95e6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007feefeef19b5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 11 (Thread 0x7feed4417700 (LWP 14752)):
#0  0x00007feeff3a3d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c4db in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef05328314 in QSemaphore::acquire(int) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef03f8631e in KisTileDataPooler::waitForWork() () from /home/spencer/dev/kde4/release/inst/lib/libkritaimage.so.14
#4  0x00007fef03f86a74 in KisTileDataPooler::run() () from /home/spencer/dev/kde4/release/inst/lib/libkritaimage.so.14
#5  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7feed3c16700 (LWP 14753)):
#0  0x00007feeff3a3d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c4db in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef05328759 in QSemaphore::tryAcquire(int, int) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef03fa378a in KisTileDataSwapper::run() () from /home/spencer/dev/kde4/release/inst/lib/libkritaimage.so.14
#4  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x7feeb5ba5700 (LWP 14782)):
#0  0x00007feeff3a3d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c4db in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef06335394 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7feeb53a4700 (LWP 14783)):
#0  0x00007fef079c0a43 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007feefeecfff6 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007feefeed0124 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fef0545a426 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007fef05429c82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007fef05429ed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007fef05328fa7 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007fef054099ff in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7feed1dad700 (LWP 14977)):
[KCrash Handler]
#6  0x00007feed4b6db6d in KoMixColorsOpImpl<KoBgrU16Traits>::mixColors(unsigned char const* const*, short const*, unsigned int, unsigned char*) const () from /home/spencer/dev/kde4/release/inst/lib/kde4/kolcmsengine.so
#7  0x00007feed6d5ef47 in KisFilterNoise::processImpl(KisSharedPtr<KisPaintDevice>, QRect const&, KisFilterConfiguration const*, KoUpdater*) const () from /home/spencer/dev/kde4/release/inst/lib/kde4/kritanoisefilter.so
#8  0x00007fef03fd56ed in KisFilter::process(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisSelection>, QRect const&, KisFilterConfiguration const*, KoUpdater*) const () from /home/spencer/dev/kde4/release/inst/lib/libkritaimage.so.14
#9  0x00007fef03fd5c47 in KisFilter::process(KisSharedPtr<KisPaintDevice>, QRect const&, KisFilterConfiguration const*, KoUpdater*) const () from /home/spencer/dev/kde4/release/inst/lib/libkritaimage.so.14
#10 0x00007fef0745c4c1 in generatePreview(KisFilter const*, KisSharedPtr<KisPaintDevice>, KisFilterConfiguration*) () from /home/spencer/dev/kde4/release/inst/lib/libkritaui.so.14
#11 0x00007fef0745dc24 in QtConcurrent::StoredFunctorCall3<QImage, QImage (*)(KisFilter const*, KisSharedPtr<KisPaintDevice>, KisFilterConfiguration*), KisSharedPtr<KisFilter>, KisSharedPtr<KisPaintDevice>, KisFilterConfiguration*>::runFunctor() () from /home/spencer/dev/kde4/release/inst/lib/libkritaui.so.14
#12 0x00007fef0745d936 in QtConcurrent::RunFunctionTask<QImage>::run() () from /home/spencer/dev/kde4/release/inst/lib/libkritaui.so.14
#13 0x00007fef0531f4f2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#14 0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#16 0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#17 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7feed25ae700 (LWP 14993)):
#0  0x00007feeff3a40fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c43f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531f5bf in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7feeb86cf700 (LWP 14994)):
#0  0x00007feeff3a40fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c43f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531f5bf in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7feeb4ba3700 (LWP 14995)):
#0  0x00007feeff3a40fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c43f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531f5bf in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7feeb7ece700 (LWP 14996)):
#0  0x00007feeff3a40fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c43f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531f5bf in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7feed2daf700 (LWP 14997)):
#0  0x00007feeff3a40fe in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c43f in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531f5bf in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef0532bfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007feeff39fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fef079cc3fd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fef080c17c0 (LWP 14717)):
#0  0x00007feeff3a3d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fef0532c4db in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007fef0531ec7e in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007fef053206a4 in QThreadPool::~QThreadPool() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007fef053206e9 in QThreadPool::~QThreadPool() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007fef05320715 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007fef07913901 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x00007fef07913985 in exit () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00007feef4933624 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#9  0x00007fef06b656b8 in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib/libkdeui.so.5
#10 0x00007fef04aa02be in _XIOError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#11 0x00007fef04a9dcdd in _XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#12 0x00007fef04a8f2ef in XEventsQueued () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#13 0x00007fef05ed3bdc in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007feefeecfb03 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007feefeecff96 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007feefeed0124 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007fef0545a3bf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#18 0x00007fef05ed3d9e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007fef05429c82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#20 0x00007fef05429ed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007fef0542ef67 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#22 0x00007fef07ca0feb in kdemain () from /home/spencer/dev/kde4/release/inst/lib/libkdeinit4_krita.so
#23 0x00007fef078f976d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#24 0x0000000000400651 in _start ()

Reported using DrKonqi
Comment 1 Halla Rempt 2014-04-07 08:03:08 UTC
Yes, I can confirm this filter is broken. It might make a good pre-gsoc exercise to try and fix it!
Comment 2 Spencer Brown 2014-04-08 02:25:17 UTC
Heh, I have to get caught up in school again after being ill all last week :(

But I'll definitely take a crack at it. If you can reproduce it too it must not be that bad of a bug.
Comment 3 Spencer Brown 2014-04-13 23:22:42 UTC
Created attachment 86083 [details]
attachment-20772-0.html

OK, I've made a patch that will keep the noise filter from crashing. The
crash was introduced on revision 22b92cc12aaa when we migrated to NG
iterators. I haven't figured out why the noise filter doesn't like the
sequential iterator, but it seems to work OK with the hline iterator
instead.

I've attached the patch and the revised file, so you can take your pick of
which one you'd rather download.


On Mon, Apr 7, 2014 at 3:03 AM, Boudewijn Rempt <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=333142
>
> Boudewijn Rempt <boud@valdyas.org> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |CONFIRMED
>                  CC|                            |boud@valdyas.org
>      Ever confirmed|0                           |1
>
> --- Comment #1 from Boudewijn Rempt <boud@valdyas.org> ---
> Yes, I can confirm this filter is broken. It might make a good pre-gsoc
> exercise to try and fix it!
>
> --
> You are receiving this mail because:
> You reported the bug.
>
Comment 4 Spencer Brown 2014-04-13 23:22:45 UTC
Created attachment 86084 [details]
attachment-20772-1.dat
Comment 5 Spencer Brown 2014-04-13 23:22:45 UTC
Created attachment 86085 [details]
noisefiltercrash.patch
Comment 6 Spencer Brown 2014-04-13 23:22:45 UTC
Created attachment 86086 [details]
noisefilter.cpp
Comment 7 Halla Rempt 2014-04-16 12:17:36 UTC
Hm... Dmitry suggests, remove the for (int row...) loop completely. Then it should work.
Comment 8 Spencer Brown 2014-04-16 15:04:24 UTC
I think I tried that with the sequential iterator and it still crashed. But
when I get back from class I can check it again.


On Wed, Apr 16, 2014 at 7:17 AM, Boudewijn Rempt <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=333142
>
> --- Comment #7 from Boudewijn Rempt <boud@valdyas.org> ---
> Hm... Dmitry suggests, remove the for (int row...) loop completely. Then it
> should work.
>
> --
> You are receiving this mail because:
> You reported the bug.
>
Comment 9 Spencer Brown 2014-04-29 20:20:55 UTC
I got around to trying it out and that fixes it. I applied for a KDE developer identity today, so if someone approves me I would be happy to push the change.
Comment 10 Halla Rempt 2014-05-08 12:55:00 UTC
Fixed in 55b3138686edae519c79b4c37b87c489f6fa2ebb