Review Request 110593: Check for null image in drop event

Elvis Stansvik elvstone at gmail.com
Wed May 22 14:39:41 BST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110593/
-----------------------------------------------------------

Review request for Calligra and C. Boemann.


Description
-------

When dropping this particular cat

http://www.mrwallpaper.com/wallpapers/Cat-Sad-Annoyed.jpg

which I've come to call Cat Astrophy, from Chromium 27.0.1453.93 onto Calligra Words, I get:

Application: Calligra Words (calligrawords), signal: Aborted
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f1591110780 (LWP 28742))]

Thread 2 (Thread 0x7f156d38f700 (LWP 28743)):
#0  0x00007f158a19909d in poll () from /usr/lib/libc.so.6
#1  0x00007f158565d134 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f158565d23c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f158b0448f6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f158b01696f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f158b016c65 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f158af1567f in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f158aff8113 in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f158af17d1f in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f158ac88dd2 in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007f158a1a1ced in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f1591110780 (LWP 28742)):
[KCrash Handler]
#5  0x00007f158a0f11c9 in raise () from /usr/lib/libc.so.6
#6  0x00007f158a0f25c8 in abort () from /usr/lib/libc.so.6
#7  0x00007f158af0d8df in qt_message_output(QtMsgType, char const*) () from /usr/lib/libQtCore.so.4
#8  0x00007f158af0da69 in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f158af0e274 in qFatal(char const*, ...) () from /usr/lib/libQtCore.so.4
#10 0x00007f1572f2d8bd in PictureShapeFactory::createShape (this=0x1e5d8b0, params=0x7fff51f7f660, documentResources=0x1e47790) at /home/estan/kde4/src/calligra/plugins/pictureshape/PictureShapeFactory.cpp:71
#11 0x00007f157b1bc597 in KWView::addImages (this=0x23d1a10, imageList=..., insertAt=...) at /home/estan/kde4/src/calligra/words/part/KWView.cpp:1134
#12 0x00007f1590a88804 in KoView::dropEvent (this=0x23d1a10, event=0x7fff51f7fd20) at /home/estan/kde4/src/calligra/libs/main/KoView.cpp:277
#13 0x00007f158bf371be in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#14 0x00007f158bee80ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#15 0x00007f158beef4fe in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#16 0x00007f1590a1827a in KoApplication::notify (this=0x7fff51f80470, receiver=0x2571c00, event=0x7fff51f7fd20) at /home/estan/kde4/src/calligra/libs/main/KoApplication.cpp:556
#17 0x00007f158b017c3d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#18 0x00007f158bf6d481 in ?? () from /usr/lib/libQtGui.so.4
#19 0x00007f158bf519bd in QApplication::x11ClientMessage(QWidget*, _XEvent*, bool) () from /usr/lib/libQtGui.so.4
#20 0x00007f158bf5e88f in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#21 0x00007f158bf84fb2 in ?? () from /usr/lib/libQtGui.so.4
#22 0x00007f158565ce46 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#23 0x00007f158565d198 in ?? () from /usr/lib/libglib-2.0.so.0
#24 0x00007f158565d23c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#25 0x00007f158b0448d5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#26 0x00007f158bf85066 in ?? () from /usr/lib/libQtGui.so.4
#27 0x00007f158b01696f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#28 0x00007f158b016c65 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#29 0x00007f158b01bccb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#30 0x00007f1590d4d2f4 in kdemain (argc=1, argv=0x7fff51f80658) at /home/estan/kde4/src/calligra/words/app/main.cpp:43
#31 0x00000000004009d2 in main (argc=1, argv=0x7fff51f80658) at /home/estan/kde4/build/calligra/words/app/calligrawords_dummy.cpp:3

Apparently it can happen that QMimeData::hasImage() can return true, but QMimeData::imageData returns a null QImage. I guess this should be considered a Qt bug.

This fix simply introduces a check for a null image to avoid the crash. I guess I should investigate why Qt ends up in this state in the first place, but it doesn't hurt to be careful.


Diffs
-----

  libs/main/KoView.cpp c9c82e5 

Diff: http://git.reviewboard.kde.org/r/110593/diff/


Testing
-------

Dropped Cat Astrophy before and after the fix and the crash is gone.


Thanks,

Elvis Stansvik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130522/af620079/attachment.htm>


More information about the calligra-devel mailing list