Bug 284457

Summary: Remaining tools need to be ported to the strokes framework
Product: [Applications] krita Reporter: Cyrille Berger <cberger>
Component: ToolsAssignee: Dmitry Kazakov <dimula73>
Severity: normal CC: bugs_kde_org2, dimula73, halla
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch for this bug.

Description Cyrille Berger 2011-10-19 12:21:17 UTC
* create a big image (like 2000x2000)
* fill it with a gradient (cropping an empty image seems to not cause the problem)
* crop it
* undo the crop
* redo the crop

=> asserts !

Here is the backtrace:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffc9fef700 (LWP 26719)]
0x00007fffef1d6405 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007fffef1d6405 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fffef1d9680 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff749b351 in qt_message_output (msgType=<optimized out>, 
    buf=0x7fffbceb8cb8 "ASSERT failure in QVector<T>::operator[]: \"index out of range\", file /usr/include/qt4/QtCore/qvector.h, line 347") at global/qglobal.cpp:2306
#3  0x00007ffff749b6cf in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, 
    msg=0x7ffff75e9588 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fffc9fee408) at global/qglobal.cpp:2352
#4  0x00007ffff749b874 in qFatal (msg=<optimized out>) at global/qglobal.cpp:2535
#5  0x00007ffff7092060 in operator[] (this=0x1f37c610, i=13) at /usr/include/qt4/QtCore/qvector.h:347
#6  getTextureTileCR (row=1, col=4, this=0x1f37c5a0)
    at /home/cyrille/Projects/kde4/src/calligra/krita/ui/opengl/kis_opengl_image_textures.h:127
#7  KisOpenGLImageTextures::updateCache (this=0x1f37c5a0, rect=<optimized out>)
    at /home/cyrille/Projects/kde4/src/calligra/krita/ui/opengl/kis_opengl_image_textures.cpp:199
#8  0x00007ffff6eb744b in KisCanvas2::startUpdateCanvasProjection (this=0x1f35fb60, rc=...)
    at /home/cyrille/Projects/kde4/src/calligra/krita/ui/canvas/kis_canvas2.cpp:435
#9  0x00007ffff6eb92bf in KisCanvas2::qt_metacall (this=0x1f35fb60, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x7fffc9feead0)
    at /home/cyrille/Projects/kde4/build/calligra/krita/ui/kis_canvas2.moc:122
#10 0x00007ffff759db1a in QMetaObject::activate (sender=0x8762f80, m=<optimized out>, local_signal_index=<optimized out>, 
    argv=0x7fffc9feead0) at kernel/qobject.cpp:3278
#11 0x00007ffff69d5cc5 in KisImage::sigImageUpdated (this=<optimized out>, _t1=<optimized out>)
    at /home/cyrille/Projects/kde4/build/calligra/krita/image/kis_image.moc:211
#12 0x00007ffff69c96aa in KisUpdateScheduler::continueUpdate (this=0x1b7bd7b0, rect=...)
    at /home/cyrille/Projects/kde4/src/calligra/krita/image/kis_update_scheduler.cpp:320
#13 0x00007ffff688f947 in KisUpdateScheduler::qt_metacall (this=0x1b7bd7b0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, 
    _a=0x7fffc9feec10) at /home/cyrille/Projects/kde4/build/calligra/krita/image/moc_kis_update_scheduler.cpp:77
#14 0x00007ffff759db1a in QMetaObject::activate (sender=0x1e3a8dd0, m=<optimized out>, local_signal_index=<optimized out>, 
    argv=0x7fffc9feec10) at kernel/qobject.cpp:3278
#15 0x00007ffff6890122 in KisUpdaterContext::sigContinueUpdate (this=<optimized out>, _t1=<optimized out>)
    at /home/cyrille/Projects/kde4/build/calligra/krita/image/moc_kis_updater_context.cpp:94
#16 0x00007ffff6890225 in KisUpdaterContext::qt_metacall (this=0x1e3a8dd0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, 
    _a=0x7fffc9feed10) at /home/cyrille/Projects/kde4/build/calligra/krita/image/moc_kis_updater_context.cpp:79
#17 0x00007ffff759db1a in QMetaObject::activate (sender=0x8c1f090, m=<optimized out>, local_signal_index=<optimized out>, 
    argv=0x7fffc9feed10) at kernel/qobject.cpp:3278
#18 0x00007ffff6890a52 in KisUpdateJobItem::sigContinueUpdate (this=<optimized out>, _t1=<optimized out>)
    at /home/cyrille/Projects/kde4/build/calligra/krita/image/moc_kis_update_job_item.cpp:91
#19 0x00007ffff68982c7 in KisUpdateJobItem::runMergeJob (this=0x8c1f090)
    at /home/cyrille/Projects/kde4/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_update_job_item.h:78
#20 0x00007ffff6898691 in KisUpdateJobItem::run (this=0x8c1f090)
    at /home/cyrille/Projects/kde4/build/calligra/krita/image/../../../../src/calligra/krita/image/kis_update_job_item.h:56
#21 0x00007ffff74996d5 in QThreadPoolThread::run (this=0x1b7afcf0) at concurrent/qthreadpool.cpp:106
#22 0x00007ffff74a4c05 in QThreadPrivate::start (arg=0x1b7afcf0) at thread/qthread_unix.cpp:320
#23 0x00007fffeef8eb40 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#24 0x00007fffef27936d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#25 0x0000000000000000 in ?? ()

Here is the command line output:

ASSERT failure in QVector<T>::operator[]: "index out of range", file /usr/include/qt4/QtCore/qvector.h, line 347
Comment 1 Halla Rempt 2011-10-19 12:32:52 UTC
Hm, I cannot reproduce. I'm confident that the attached patch will fix the crash -- I'm not sure what will happen to the canvas update, though.
Comment 2 Halla Rempt 2011-10-19 12:33:34 UTC
Created attachment 64701 [details]
patch for this bug.
Comment 3 Cyrille Berger 2011-10-19 13:06:49 UTC
If it helps, I got a similar crash when rotating to 90, will test the patch later tonight.
Comment 4 Halla Rempt 2011-10-19 13:10:10 UTC
With opengl enabled, I do get a crash when rotating, though not with cropping. The backtrace is different, though:

Thread 1 (Thread 0x7f652fde2760 (LWP 32705)):
[KCrash Handler]
#6  0x00007f652ee1bbe6 in KisTextureTile::update (this=0xefcc610, updateInfo=...) at /home/boud/kde/src/calligra/krita/ui/opengl/kis_texture_tile.cpp:88
#7  0x00007f652ee119d8 in KisOpenGLImageTextures::recalculateCache (this=0x7f6508fddfa0, info=<value optimized out>) at /home/boud/kde/src/calligra/krita/ui/opengl/kis_opengl_image_textures.cpp:249
#8  0x00007f652ec015d0 in KisCanvas2::updateCanvasProjection (this=0x98b2b80, info=<value optimized out>) at /home/boud/kde/src/calligra/krita/ui/canvas/kis_canvas2.cpp:456
#9  0x00007f652ec028e5 in KisCanvas2::qt_metacall (this=0x98b2b80, _c=<value optimized out>, _id=8, _a=<value optimized out>) at /home/boud/kde/build/calligra/krita/ui/kis_canvas2.moc:123
#10 0x00007f652f5497aa in QObject::event (this=0x98b2b80, e=<value optimized out>) at kernel/qobject.cpp:1226
#11 0x00007f6528378264 in QApplicationPrivate::notify_helper (this=0x7aee80, receiver=0x98b2b80, e=0x84e7bf0) at kernel/qapplication.cpp:4481
#12 0x00007f652838081a in QApplication::notify (this=<value optimized out>, receiver=0x98b2b80, e=0x84e7bf0) at kernel/qapplication.cpp:4360
#13 0x00007f6528fe0346 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#14 0x00007f652f5357cc in QCoreApplication::notifyInternal (this=0x7fffb0c2ad80, receiver=0x98b2b80, event=0x84e7bf0) at kernel/qcoreapplication.cpp:787
#15 0x00007f652f538fc5 in sendEvent (receiver=0x0, event_type=0, data=0x60b400) at kernel/qcoreapplication.h:215
#16 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x60b400) at kernel/qcoreapplication.cpp:1428
#17 0x00007f652f563820 in QEventDispatcherUNIX::processEvents (this=0x610e10, flags=...) at kernel/qeventdispatcher_unix.cpp:905
#18 0x00007f652841efcc in QEventDispatcherX11::processEvents (this=0x610e10, flags=...) at kernel/qeventdispatcher_x11.cpp:152
#19 0x00007f652f534c22 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#20 0x00007f652f534e35 in QEventLoop::exec (this=0x7fffb0c2ad30, flags=...) at kernel/qeventloop.cpp:201
#21 0x00007f652f53927b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1064
#22 0x00007f652f91f87d in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/boud/kde/src/calligra/krita/main.cc:71
#23 0x00007f6526d75bfd in __libc_start_main () from /lib64/libc.so.6
#24 0x0000000000400929 in _start () at ../sysdeps/x86_64/elf/start.S:113
Comment 5 Cyrille Berger 2011-10-19 18:45:45 UTC
Well before your patch:
* crop/undo/redo and rotate image => assert with the first backtrace

After the patch:
* crop/undo/redo => no crash
* rotate image => crash with the same backtrace as #4
Comment 6 Halla Rempt 2011-10-19 18:46:38 UTC
Yes, there's definitely something very wrong :-( This is a pretty serious bug and if we don't find a fix, we'll probably have to disable opengl for 2.4.
Comment 7 Dmitry Kazakov 2011-10-23 17:52:52 UTC
Git commit 724d50b6497f935a7c77fcb4f218ec3ccfcf35fa by Dmitry Kazakov.
Committed on 23/10/2011 at 19:51.
Pushed by dkazakov into branch 'master'.

Added NO_UI_UPDATES parameter to the processing applicator

This parameter should be used when the action emits other signals
which update the UI's projection like sigImageSizeChanged.

We probably shouldn't close this bug, because rotate, shear and other
actions are still vulnerable as they have not been ported to processings

M  +22   -3    krita/image/kis_image.cc
M  +3    -0    krita/image/kis_image.h
M  +3    -0    krita/image/kis_image_interfaces.h
M  +34   -0    krita/image/kis_processing_applicator.cpp
M  +1    -0    krita/image/kis_processing_applicator.h
M  +32   -0    krita/image/tests/kis_processing_applicator_test.cpp
M  +1    -0    krita/image/tests/kis_processing_applicator_test.h

Comment 8 Halla Rempt 2011-12-09 11:42:07 UTC
Sorry for the noise.
Comment 9 Dmitry Kazakov 2012-02-08 05:46:16 UTC
There is no crash here now. I will set the severity to Normal and leave this bug as a reminder that the rest of the methods of KisImage should be ported to strokes.
Comment 10 Halla Rempt 2012-02-29 12:30:48 UTC
Dmitry, can you append a list to this bug of all the actions that still need to be ported?
Comment 11 Halla Rempt 2012-02-29 12:34:15 UTC
*** Bug 251389 has been marked as a duplicate of this bug. ***
Comment 12 Halla Rempt 2013-09-25 14:27:34 UTC
Gradient tool is fixed, so we're done with this.