Bug 372245

Summary: D&D of a shape layer between two images causes a crash
Product: [Applications] krita Reporter: Dmitry Kazakov <dimula73>
Component: Layers/VectorAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 3.1 Beta   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dmitry Kazakov 2016-11-09 08:02:31 UTC
Seems to be a regression after the saving fix!

(gdb) bt
#0  KisImage::width (this=0x0) at /home/devel5/kde-src/krita5/libs/image/kis_image.cc:959
#1  0x00007ffff7752756 in KisKraSaver::saveXML (this=0x91b6200, doc=..., image=...) at /home/devel5/kde-src/krita5/libs/ui/kra/kis_kra_saver.cpp:96
#2  0x00007ffff78b8a23 in KisDocument::saveXML (this=this@entry=0x98c0600) at /home/devel5/kde-src/krita5/libs/ui/KisDocument.cpp:1942
#3  0x00007ffff78b8c77 in KisDocument::saveToStream (this=this@entry=0x98c0600, dev=dev@entry=0x7fffffffadc0) at /home/devel5/kde-src/krita5/libs/ui/KisDocument.cpp:1080
#4  0x00007ffff78bc585 in KisDocument::saveNativeFormatCalligra (this=this@entry=0x98c0600, store=store@entry=0x88744c0) at /home/devel5/kde-src/krita5/libs/ui/KisDocument.cpp:1035
#5  0x00007ffff768d022 in serializeToByteArray (nodes=...) at /home/devel5/kde-src/krita5/libs/ui/kis_mimedata.cpp:117
#6  0x00007ffff768d383 in KisMimeData::retrieveData (this=0x11a80550, mimetype=..., preferredType=<optimized out>) at /home/devel5/kde-src/krita5/libs/ui/kis_mimedata.cpp:139
#7  0x00007ffff5d978dc in QMimeDataPrivate::retrieveTypedData (this=0xd58a310, format=..., type=type@entry=QVariant::ByteArray) at kernel/qmimedata.cpp:100
#8  0x00007ffff5d98b4d in QMimeData::data (this=this@entry=0x11a80550, mimeType=...) at kernel/qmimedata.cpp:546
#9  0x00007ffff76894e2 in KisMimeData::loadNodes (data=0x11a80550, imageBounds=..., preferredCenter=..., forceRecenter=forceRecenter@entry=false, image=..., shapeController=0x8eaaa80) at /home/devel5/kde-src/krita5/libs/ui/kis_mimedata.cpp:275
#10 0x00007ffff791198c in KisView::dropEvent (this=0x8d168c0, event=0x7fffffffbb10) at /home/devel5/kde-src/krita5/libs/ui/KisView.cpp:512
#11 0x00007ffff66a4f88 in QWidget::event (this=0x8d168c0, event=0x7fffffffbb10) at kernel/qwidget.cpp:9044
#12 0x00007ffff666205c in QApplicationPrivate::notify_helper (this=this@entry=0xc52990, receiver=receiver@entry=0x8d168c0, e=e@entry=0x7fffffffbb10) at kernel/qapplication.cpp:3716
#13 0x00007ffff6668136 in QApplication::notify (this=<optimized out>, receiver=receiver@entry=0x8cb28f0, e=e@entry=0x7fffffffbb10) at kernel/qapplication.cpp:3499
#14 0x00007ffff78ab2c7 in KisApplication::notify (this=<optimized out>, receiver=0x8cb28f0, event=0x7fffffffbb10) at /home/devel5/kde-src/krita5/libs/ui/KisApplication.cpp:519
#15 0x00007ffff5d6f38b in QCoreApplication::notifyInternal (this=0x7fffffffdf30, receiver=0x8cb28f0, event=event@entry=0x7fffffffbb10) at kernel/qcoreapplication.cpp:965
#16 0x00007ffff66c108c in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffbb10, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227
#17 QWidgetWindow::handleDropEvent (this=this@entry=0x7ad2510, event=event@entry=0x7fffffffbeb0) at kernel/qwidgetwindow.cpp:803
#18 0x00007ffff66c1bdb in QWidgetWindow::event (this=0x7ad2510, event=0x7fffffffbeb0) at kernel/qwidgetwindow.cpp:250
#19 0x00007ffff666205c in QApplicationPrivate::notify_helper (this=this@entry=0xc52990, receiver=receiver@entry=0x7ad2510, e=e@entry=0x7fffffffbeb0) at kernel/qapplication.cpp:3716
#20 0x00007ffff6667516 in QApplication::notify (this=0x7fffffffdf30, receiver=receiver@entry=0x7ad2510, e=e@entry=0x7fffffffbeb0) at kernel/qapplication.cpp:3499
#21 0x00007ffff78ab2c7 in KisApplication::notify (this=<optimized out>, receiver=0x7ad2510, event=0x7fffffffbeb0) at /home/devel5/kde-src/krita5/libs/ui/KisApplication.cpp:519
#22 0x00007ffff5d6f38b in QCoreApplication::notifyInternal (this=0x7fffffffdf30, receiver=receiver@entry=0x7ad2510, event=event@entry=0x7fffffffbeb0) at kernel/qcoreapplication.cpp:965
#23 0x00007ffff60b2b29 in QCoreApplication::sendEvent (event=0x7fffffffbeb0, receiver=0x7ad2510) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:224
#24 QGuiApplicationPrivate::processDrop (w=0x7ad2510, dropData=0x11a80550, p=..., supportedActions=...) at kernel/qguiapplication.cpp:2719
#25 0x00007ffff6096fa9 in QWindowSystemInterface::handleDrop (w=<optimized out>, dropData=<optimized out>, p=..., supportedActions=...) at kernel/qwindowsysteminterface.cpp:650
#26 0x00007fffe565a171 in QXcbDrag::handleDrop (this=this@entry=0xc86840, event=event@entry=0x7fffffffbfe0) at qxcbdrag.cpp:964
#27 0x00007fffe565c48e in QXcbDrag::drop (this=0xc86840, event=<optimized out>) at qxcbdrag.cpp:523
#28 0x00007ffff60a55bd in QBasicDrag::eventFilter (this=0xc86840, o=<optimized out>, e=0x7fffffffc420) at kernel/qsimpledrag.cpp:148
#29 0x00007ffff5d6f052 in QCoreApplicationPrivate::sendThroughApplicationEventFilters (this=this@entry=0xc52990, receiver=receiver@entry=0xde55d40, event=event@entry=0x7fffffffc420) at kernel/qcoreapplication.cpp:1053
#30 0x00007ffff6661fe8 in QApplicationPrivate::notify_helper (this=this@entry=0xc52990, receiver=receiver@entry=0xde55d40, e=e@entry=0x7fffffffc420) at kernel/qapplication.cpp:3691
#31 0x00007ffff6667516 in QApplication::notify (this=0x7fffffffdf30, receiver=receiver@entry=0xde55d40, e=e@entry=0x7fffffffc420) at kernel/qapplication.cpp:3499
#32 0x00007ffff78ab2c7 in KisApplication::notify (this=<optimized out>, receiver=0xde55d40, event=0x7fffffffc420) at /home/devel5/kde-src/krita5/libs/ui/KisApplication.cpp:519
#33 0x00007ffff5d6f38b in QCoreApplication::notifyInternal (this=0x7fffffffdf30, receiver=receiver@entry=0xde55d40, event=event@entry=0x7fffffffc420) at kernel/qcoreapplication.cpp:965
#34 0x00007ffff60b14e1 in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffc420, receiver=0xde55d40) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227
#35 QGuiApplicationPrivate::processMouseEvent (e=0x8f51ed0) at kernel/qguiapplication.cpp:1804
#36 0x00007ffff60b31a5 in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x8f51ed0) at kernel/qguiapplication.cpp:1596
#37 0x00007ffff6096f08 in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at kernel/qwindowsysteminterface.cpp:625
#38 0x00007fffe567e060 in userEventSourceDispatch (source=<optimized out>) at eventdispatchers/qeventdispatcher_glib.cpp:70
#39 0x00007fffef7ce1a7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#40 0x00007fffef7ce400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#41 0x00007fffef7ce4ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#42 0x00007ffff5dc57cf in QEventDispatcherGlib::processEvents (this=0xd75110, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#43 0x00007ffff5d6cb4a in QEventLoop::exec (this=this@entry=0x930ef60, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#44 0x00007ffff60a59a2 in QBasicDrag::drag (this=0xc86840, o=<optimized out>) at kernel/qsimpledrag.cpp:177
#45 0x00007ffff60be509 in QDragManager::drag (this=0x8b231f0, o=o@entry=0x7de5570) at kernel/qdnd.cpp:135
#46 0x00007ffff60bd8e7 in QDrag::exec (this=this@entry=0x7de5570, supportedActions=..., supportedActions@entry=..., defaultDropAction=<optimized out>) at kernel/qdrag.cpp:274
#47 0x00007ffff68ca228 in QAbstractItemView::startDrag (this=this@entry=0x89894b0, supportedActions=supportedActions@entry=...) at itemviews/qabstractitemview.cpp:3606
#48 0x00007ffff78cde93 in KisNodeView::startDrag (this=this@entry=0x89894b0, supportedActions=...) at /home/devel5/kde-src/krita5/libs/ui/KisNodeView.cpp:373
#49 0x00007ffff68c8ac0 in QAbstractItemView::mouseMoveEvent (this=this@entry=0x89894b0, event=event@entry=0x7fffffffd320) at itemviews/qabstractitemview.cpp:1768
#50 0x00007ffff6908bb3 in QTreeView::mouseMoveEvent (this=0x89894b0, event=0x7fffffffd320) at itemviews/qtreeview.cpp:1991
#51 0x00007ffff66a4f88 in QWidget::event (this=this@entry=0x89894b0, event=event@entry=0x7fffffffd320) at kernel/qwidget.cpp:9044
#52 0x00007ffff67a3b4e in QFrame::event (this=0x89894b0, e=0x7fffffffd320) at widgets/qframe.cpp:540
#53 0x00007ffff68c95bb in QAbstractItemView::viewportEvent (this=this@entry=0x89894b0, event=event@entry=0x7fffffffd320) at itemviews/qabstractitemview.cpp:1685
#54 0x00007ffff69080ec in QTreeView::viewportEvent (this=this@entry=0x89894b0, event=event@entry=0x7fffffffd320) at itemviews/qtreeview.cpp:1309
#55 0x00007ffff78ccc3b in KisNodeView::viewportEvent (this=0x89894b0, e=0x7fffffffd320) at /home/devel5/kde-src/krita5/libs/ui/KisNodeView.cpp:290
#56 0x00007ffff5d6f172 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=this@entry=0xc52990, receiver=receiver@entry=0x8983950, event=event@entry=0x7fffffffd320) at kernel/qcoreapplication.cpp:1072
#57 0x00007ffff666203c in QApplicationPrivate::notify_helper (this=this@entry=0xc52990, receiver=receiver@entry=0x8983950, e=e@entry=0x7fffffffd320) at kernel/qapplication.cpp:3712
#58 0x00007ffff6667c19 in QApplication::notify (this=<optimized out>, receiver=receiver@entry=0x8983950, e=e@entry=0x7fffffffd320) at kernel/qapplication.cpp:3276
#59 0x00007ffff78ab2c7 in KisApplication::notify (this=<optimized out>, receiver=0x8983950, event=0x7fffffffd320) at /home/devel5/kde-src/krita5/libs/ui/KisApplication.cpp:519
#60 0x00007ffff5d6f38b in QCoreApplication::notifyInternal (this=0x7fffffffdf30, receiver=receiver@entry=0x8983950, event=event@entry=0x7fffffffd320) at kernel/qcoreapplication.cpp:965
#61 0x00007ffff6666b32 in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffd320, receiver=0x8983950) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227
#62 QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x8983950, event=event@entry=0x7fffffffd320, alienWidget=alienWidget@entry=0x8983950, nativeWidget=0x7afa910, buttonDown=buttonDown@entry=0x7ffff6b92b20 <qt_button_down>, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:2770
#63 0x00007ffff66bf57b in QWidgetWindow::handleMouseEvent (this=this@entry=0x7ad2510, event=event@entry=0x7fffffffd7b0) at kernel/qwidgetwindow.cpp:555
#64 0x00007ffff66c1b3b in QWidgetWindow::event (this=0x7ad2510, event=0x7fffffffd7b0) at kernel/qwidgetwindow.cpp:210
#65 0x00007ffff666205c in QApplicationPrivate::notify_helper (this=this@entry=0xc52990, receiver=receiver@entry=0x7ad2510, e=e@entry=0x7fffffffd7b0) at kernel/qapplication.cpp:3716
#66 0x00007ffff6667516 in QApplication::notify (this=0x7fffffffdf30, receiver=receiver@entry=0x7ad2510, e=e@entry=0x7fffffffd7b0) at kernel/qapplication.cpp:3499
#67 0x00007ffff78ab2c7 in KisApplication::notify (this=<optimized out>, receiver=0x7ad2510, event=0x7fffffffd7b0) at /home/devel5/kde-src/krita5/libs/ui/KisApplication.cpp:519
#68 0x00007ffff5d6f38b in QCoreApplication::notifyInternal (this=0x7fffffffdf30, receiver=receiver@entry=0x7ad2510, event=event@entry=0x7fffffffd7b0) at kernel/qcoreapplication.cpp:965
#69 0x00007ffff60b14e1 in QCoreApplication::sendSpontaneousEvent (event=0x7fffffffd7b0, receiver=0x7ad2510) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:227
#70 QGuiApplicationPrivate::processMouseEvent (e=0xea489c0) at kernel/qguiapplication.cpp:1804
#71 0x00007ffff60b31a5 in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0xea489c0) at kernel/qguiapplication.cpp:1596
#72 0x00007ffff6096f08 in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at kernel/qwindowsysteminterface.cpp:625
#73 0x00007fffe567e060 in userEventSourceDispatch (source=<optimized out>) at eventdispatchers/qeventdispatcher_glib.cpp:70
#74 0x00007fffef7ce1a7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#75 0x00007fffef7ce400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#76 0x00007fffef7ce4ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#77 0x00007ffff5dc57cf in QEventDispatcherGlib::processEvents (this=0xd75110, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#78 0x00007ffff5d6cb4a in QEventLoop::exec (this=this@entry=0x7fffffffdb30, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#79 0x00007ffff5d74bec in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1229
#80 0x00007ffff60a8bfc in QGuiApplication::exec () at kernel/qguiapplication.cpp:1542
#81 0x00007ffff665e495 in QApplication::exec () at kernel/qapplication.cpp:2976
#82 0x0000000000404ccf in main (argc=1, argv=<optimized out>) at /home/devel5/kde-src/krita5/krita/main.cc:258
Comment 1 Dmitry Kazakov 2016-11-09 14:50:41 UTC
Git commit 321bdfcd88eebd0eb16a00fd0301d5d4558ce683 by Dmitry Kazakov.
Committed on 09/11/2016 at 14:50.
Pushed by dkazakov into branch 'krita/3.1'.

Fix a stupid crash in KisMimeData

Never ever pass anything, especially shared pointers by reference!
It is completely not obvious that the pointer is changed by the
function internally!

M  +9    -9    libs/ui/kis_mimedata.cpp
M  +1    -1    libs/ui/kis_mimedata.h

http://commits.kde.org/krita/321bdfcd88eebd0eb16a00fd0301d5d4558ce683
Comment 2 Dmitry Kazakov 2016-11-09 14:50:41 UTC
Git commit a70d80dc91c14d116406aff870496dff39788003 by Dmitry Kazakov.
Committed on 09/11/2016 at 14:49.
Pushed by dkazakov into branch 'krita/3.1'.

Fix a crash when D&D shape layers between images

saveNativeFormatCalligra() was public, so it could be called
by everyone. And d->savingImage should have been prepared for the
call.

M  +17   -3    libs/ui/KisDocument.cpp
M  +5    -2    libs/ui/KisDocument.h
M  +1    -1    libs/ui/kis_mimedata.cpp

http://commits.kde.org/krita/a70d80dc91c14d116406aff870496dff39788003
Comment 3 Dmitry Kazakov 2016-11-10 08:55:19 UTC
Git commit a50d5403974f2b8c741479ad130084f7380230a4 by Dmitry Kazakov.
Committed on 09/11/2016 at 14:51.
Pushed by dkazakov into branch 'rempt/impex-refactoring'.

Fix a stupid crash in KisMimeData

Never ever pass anything, especially shared pointers by reference!
It is completely not obvious that the pointer is changed by the
function internally!

M  +9    -9    libs/ui/kis_mimedata.cpp
M  +1    -1    libs/ui/kis_mimedata.h

http://commits.kde.org/krita/a50d5403974f2b8c741479ad130084f7380230a4