Bug 363296

Summary: Creating animated brush tip crashes Krita
Product: [Applications] krita Reporter: basse <bastian.salmela>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: griffinvalley, halla
Priority: NOR Keywords: regression
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: backtrace
file from which I tried to make the brush out of

Description basse 2016-05-19 20:42:45 UTC
Application: krita ()

Qt Version: 5.5.1
Operating System: Linux 4.4.0-22-generic x86_64
Distribution: Ubuntu 16.04 LTS

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

I'm trying to create an animated brush tip that I could spray around (image hose like, big spacing). 
So I have my image with brush frames in separate layers, I go to brush settings -> tip -> predefined and hit "Stamp".
I give it a name, select "Animated" from "Style" and "Random" from "Selection", and when I hit OK I get a crash.

couple of times before I managed to make krita save it, but there are some strange things in those too.. 
like Random isn't really random, when you first click it's always the same image from the sequence.  
and if I go and paint away with long spacing sometimes two images end up on top of each other.

but, now, it's just crashing.  
I attach my image, brush and backtrace.

.b

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 0x7f7d2ab1b8c0 (LWP 17010))]

Thread 4 (Thread 0x7f7cf4f67700 (LWP 17012)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f7d28999aeb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007f7d2899271b in QSemaphore::acquire(int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007f7d26515b9e in KisTileDataPooler::waitForWork (this=0x7f7d269a8400 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder>) at /home/basse/kf5/src/krita/libs/image/tiles3/kis_tile_data_pooler.cc:165
#4  0x00007f7d26516351 in KisTileDataPooler::run (this=0x7f7d269a8400 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder>) at /home/basse/kf5/src/krita/libs/image/tiles3/kis_tile_data_pooler.cc:187
#5  0x00007f7d2899884e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f7d230ad6fa in start_thread (arg=0x7f7cf4f67700) at pthread_create.c:333
#7  0x00007f7d28098b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f7cf4766700 (LWP 17013)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f7d28999aeb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007f7d289929c6 in QSemaphore::tryAcquire(int, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007f7d26531163 in KisTileDataSwapper::waitForWork (this=<optimized out>) at /home/basse/kf5/src/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#4  0x00007f7d2653135a in KisTileDataSwapper::run (this=0x7f7d269a8440 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder+64>) at /home/basse/kf5/src/krita/libs/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#5  0x00007f7d2899884e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f7d230ad6fa in start_thread (arg=0x7f7cf4766700) at pthread_create.c:333
#7  0x00007f7d28098b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f7cf3f65700 (LWP 17014)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f7d28999aeb in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007f7d2969f72a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#3  0x00007f7d2899884e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f7d230ad6fa in start_thread (arg=0x7f7cf3f65700) at pthread_create.c:333
#5  0x00007f7d28098b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f7d2ab1b8c0 (LWP 17010)):
[KCrash Handler]
#6  KisCustomBrushWidget::slotAddPredefined (this=0x16647a50) at /home/basse/kf5/src/krita/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp:149
#7  0x00007f7d0677d395 in KisCustomBrushWidget::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /home/basse/kf5/build/krita/plugins/paintops/libpaintop/moc_kis_custom_brush_widget.cpp:164
#8  0x00007f7d28ba7fca in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007f7d28ba7fca in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007f7d295959f0 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f7d28ba7fca in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007f7d298061b2 in QAbstractButton::clicked(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007f7d29568f04 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007f7d2956a519 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f7d2956a694 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f7d294aef88 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007f7d2946c05c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007f7d29471c19 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007f7d2a5f7537 in KisApplication::notify (this=<optimized out>, receiver=0x16729f00, event=0x7ffd59005060) at /home/basse/kf5/src/krita/libs/ui/KisApplication.cpp:501
#20 0x00007f7d28b7962b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007f7d29470b32 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007f7d294c957b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007f7d294cbb3b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007f7d2946c05c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007f7d29471516 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007f7d2a5f7537 in KisApplication::notify (this=<optimized out>, receiver=0x16730810, event=0x7ffd590054f0) at /home/basse/kf5/src/krita/libs/ui/KisApplication.cpp:501
#27 0x00007f7d28b7962b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f7d28ebb521 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007f7d28ebd1e5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007f7d28ea0f38 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007f7d1af67f10 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#32 0x00007f7d22b8c127 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007f7d22b8c380 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f7d22b8c42c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f7d28bcfa7f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#36 0x00007f7d28b76dea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007f7d29666c7d in QDialog::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#38 0x00007f7d06736552 in KisBrushChooser::slotOpenStampBrush (this=0x136f7220) at /home/basse/kf5/src/krita/plugins/paintops/libpaintop/kis_brush_chooser.cpp:269
#39 0x00007f7d28ba7fca in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x00007f7d298061b2 in QAbstractButton::clicked(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#41 0x00007f7d29568f04 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#42 0x00007f7d2956a519 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#43 0x00007f7d2956a694 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#44 0x00007f7d294aef88 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#45 0x00007f7d2946c05c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#46 0x00007f7d29471c19 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#47 0x00007f7d2a5f7537 in KisApplication::notify (this=<optimized out>, receiver=0x13729ef0, event=0x7ffd59005fb0) at /home/basse/kf5/src/krita/libs/ui/KisApplication.cpp:501
#48 0x00007f7d28b7962b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#49 0x00007f7d29470b32 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#50 0x00007f7d294c98dd in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#51 0x00007f7d294cbb3b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#52 0x00007f7d2946c05c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#53 0x00007f7d29471516 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#54 0x00007f7d2a5f7537 in KisApplication::notify (this=<optimized out>, receiver=0x152a6360, event=0x7ffd59006440) at /home/basse/kf5/src/krita/libs/ui/KisApplication.cpp:501
#55 0x00007f7d28b7962b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#56 0x00007f7d28ebb521 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#57 0x00007f7d28ebd1e5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#58 0x00007f7d28ea0f38 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#59 0x00007f7d1af67f10 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#60 0x00007f7d22b8c127 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#61 0x00007f7d22b8c380 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#62 0x00007f7d22b8c42c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#63 0x00007f7d28bcfa7f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#64 0x00007f7d28b76dea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#65 0x00007f7d28b7ee8c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#66 0x000000000040493b in main (argc=1, argv=<optimized out>) at /home/basse/kf5/src/krita/krita/main.cc:229

Reported using DrKonqi
Comment 1 basse 2016-05-19 20:46:27 UTC
Created attachment 99084 [details]
backtrace
Comment 2 basse 2016-05-19 20:49:28 UTC
Created attachment 99085 [details]
file from which I tried to make the brush out of

it's badly drawn popcorn ;)
Comment 3 wolthera 2016-05-21 13:03:09 UTC
Can't reproduce it with incremental, only random.

GDB says the problem happens here:
Thread 1 "krita" received signal SIGSEGV, Segmentation fault.
KisCustomBrushWidget::slotAddPredefined (this=0x11f81280)
    at /home/krita/kde/src/krita/plugins/paintops/libpaintop/kis_custom_brush_widget.cpp:149
149	        KisGbrBrush *resource = dynamic_cast<KisGbrBrush*>(m_brush->clone())
Comment 4 Halla Rempt 2016-05-21 14:10:44 UTC
Regression caused by

commit 03187c24558121a4ce5423cc8f3eb794a7e89dfc
Author: Dmitry Kazakov <dimula73@gmail.com>
Date:   Mon May 16 14:12:29 2016 +0300
Follows: v2.99.90
Precedes: v2.99.91
Branches: <Expand>

    Fix brush size change while Lod0 recalculation
    
    We should really clone the brush before passing it to the stroke.
    
    The weird thing about the patch is that we don't use the cloning
    functionality for KisAutoBrush anywhere, but it still had to be
    implemented. At least it is thoroughly tested by the unittests now.
    
    Fixes T2492
    BUG:362985
Comment 5 Halla Rempt 2016-05-21 14:18:33 UTC
Oh, and do we even need to function? You can just save your .kra file as .gih.
Comment 6 Halla Rempt 2016-05-21 14:20:15 UTC
Git commit 0feb0490a039ac4132ab4d3e42c778064fe6052e by Boudewijn Rempt.
Committed on 21/05/2016 at 14:19.
Pushed by rempt into branch 'master'.

M  +2    -1    plugins/paintops/libpaintop/kis_custom_brush_widget.cpp

http://commits.kde.org/krita/0feb0490a039ac4132ab4d3e42c778064fe6052e