Bug 260429

Summary: Trying to open svg's from Blender crashes Krita (Gimp / Inkscape work fine)
Product: [Applications] calligracommon Reporter: Kubuntiac <user581>
Component: flakeAssignee: Calligra Bugs <calligra-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: cberger, halla
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: SVG from Blender which crashes Krita on import

Description David Faure 2010-12-17 19:41:15 UTC


---- Reported by bugsbane@gmail.com 2010-05-19 06:56:33 ----

Application: krita (2.3 Alpha 1)
KDE Platform Version: 4.4.3 (KDE 4.4.3) (Compiled from sources)
Qt Version: 4.7.0
Operating System: Linux 2.6.33-ARCH x86_64
Distribution (Platform): Archlinux Packages

-- Information about the crash:
Any time I use blender 2.5's "Export UV layout" to .svg and try and open it in Krita it brings up the import dialogue, but on clicking "OK" it crashes. The odd thing is that despite the image being square, that the width is reported as 1 pixel while the height is reported as 470 pixels. I can open the same .svg without problems in Gimp / Inkscape. I can also open .svg's made in Karbon and Inkscape fine.

I'm using Krita revision #1127876 with QT 4.7.0 beta 1. Example crasher file to follow.

The crash can be reproduced every time.

 -- Backtrace:
Application: Krita (kdeinit4), signal: Aborted
[Current thread is 1 (Thread 0x7f1d3f035760 (LWP 3463))]

Thread 3 (Thread 0x7f1d2c0ea710 (LWP 3464)):
#0  0x00007f1d3d2d816c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f1d3d55c30b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f1d3d558814 in QSemaphore::acquire(int) () from /usr/lib/libQtCore.so.4
#3  0x00007f1d2dc8ab6e in KisTileDataPooler::waitForWork (this=0x7f1d2dfcb5a0) at /home/user/Apps/Koffice/src/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:133
#4  0x00007f1d2dc8ada5 in KisTileDataPooler::run (this=0x7f1d2dfcb5a0) at /home/user/Apps/Koffice/src/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:162
#5  0x00007f1d3d55bc1e in ?? () from /usr/lib/libQtCore.so.4
#6  0x00007f1d3d2d397a in start_thread () from /lib/libpthread.so.0
#7  0x00007f1d3c0a401d in clone () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f1d200db710 (LWP 3466)):
#0  0x00007f1d3c09d8d3 in select () from /lib/libc.so.6
#1  0x00007f1d3d66d0c1 in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib/libQtCore.so.4
#2  0x00007f1d3d6720b2 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib/libQtCore.so.4
#3  0x00007f1d3d672c6f in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f1d3d644c62 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f1d3d644e9c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f1d3d558fef in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f1d3d55bc1e in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f1d3d2d397a in start_thread () from /lib/libpthread.so.0
#9  0x00007f1d3c0a401d in clone () from /lib/libc.so.6
#10 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f1d3f035760 (LWP 3463)):
[KCrash Handler]
#5  0x00007f1d3c008465 in raise () from /lib/libc.so.6
#6  0x00007f1d3c0098e6 in abort () from /lib/libc.so.6
#7  0x00007f1d3c041efb in __libc_message () from /lib/libc.so.6
#8  0x00007f1d3c047376 in malloc_printerr () from /lib/libc.so.6
#9  0x00007f1d3c04c05c in free () from /lib/libc.so.6
#10 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#11 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#12 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#13 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#14 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#15 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#16 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#17 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#18 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#19 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#20 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#21 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#22 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#23 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#24 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#25 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#26 0x00007f1d34818c4d in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#27 0x00007f1d34818cf9 in KoRTree<KoShape*>::NoneLeafNode::~NoneLeafNode() () from /usr/lib/libflake.so.7
#28 0x00007f1d3481786d in ~KoRTree (this=0x31972e0, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoRTree.h:348
#29 0x00007f1d348129de in ~Private (this=0x3164990, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapeManager.cpp:58
#30 ~KoShapeManager (this=0x3164990, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapeManager.cpp:192
#31 0x00007f1d34812a59 in ~KoShapeManager (this=0x3164990, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapeManager.cpp:193
#32 0x00007f1d3481c3dd in ~SimpleCanvas (this=0x1e0e560, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapePainter.cpp:47
#33 ~SimpleCanvas (this=0x1e0e560, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapePainter.cpp:48
#34 0x00007f1d3481bccd in ~Private (this=0x7fff2ea6b010, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapePainter.cpp:114
#35 ~KoShapePainter (this=0x7fff2ea6b010, __in_chrg=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/libs/flake/KoShapePainter.cpp:129
#36 0x00007f1d160bbd1a in PngExport::convert (this=0x2cb95e0, from=<value optimized out>, to=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/filters/karbon/png/PngExport.cpp:70
#37 0x00007f1d3605e98f in KOfficeFilter::ChainLink::invokeFilter (this=0x27af1f0, parentChainLink=0x0) at /home/user/Apps/Koffice/src/koffice/libs/main/KoFilterChainLink.cpp:73
#38 0x00007f1d36056993 in KoFilterChain::invokeChain (this=0x2cedc70) at /home/user/Apps/Koffice/src/koffice/libs/main/KoFilterChain.cpp:79
#39 0x00007f1d360552c9 in KoFilterManager::importDocument (this=0x27f6390, url=..., status=@0x7fff2ea6b9bc) at /home/user/Apps/Koffice/src/koffice/libs/main/KoFilterManager.cpp:163
#40 0x00007f1d3600d8f7 in KoDocument::openFile (this=0x26dec90) at /home/user/Apps/Koffice/src/koffice/libs/main/KoDocument.cpp:1253
#41 0x00007f1d3e7a9a56 in KParts::ReadOnlyPart::openUrl(KUrl const&) () from /usr/lib/libkparts.so.4
#42 0x00007f1d3601256c in KoDocument::openUrl (this=0x26dec90, _url=...) at /home/user/Apps/Koffice/src/koffice/libs/main/KoDocument.cpp:1181
#43 0x00007f1d3602e1d7 in KoMainWindow::openDocumentInternal (this=0x153d370, url=..., newdoc=0x26dec90) at /home/user/Apps/Koffice/src/koffice/libs/main/KoMainWindow.cpp:671
#44 0x00007f1d36035c28 in KoMainWindow::openDocument (this=0x153d370, url=...) at /home/user/Apps/Koffice/src/koffice/libs/main/KoMainWindow.cpp:632
#45 0x00007f1d3602ee94 in KoMainWindow::slotFileOpen (this=0x153d370) at /home/user/Apps/Koffice/src/koffice/libs/main/KoMainWindow.cpp:1211
#46 0x00007f1d36033428 in KoMainWindow::qt_metacall (this=0x153d370, _c=QMetaObject::InvokeMetaMethod, _id=5, _a=0x7fff2ea6c180)
    at /home/user/Apps/Koffice/src/koffice-build/libs/main/KoMainWindow.moc:140
#47 0x00007f1d3d65aa4f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#48 0x00007f1d3c7e7f02 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#49 0x00007f1d3c7e80fa in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#50 0x00007f1d3cc2899b in ?? () from /usr/lib/libQtGui.so.4
#51 0x00007f1d3cc2e96a in ?? () from /usr/lib/libQtGui.so.4
#52 0x00007f1d3dc5e7ed in KMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libkdeui.so.5
#53 0x00007f1d3c83f9b2 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#54 0x00007f1d3cc2fb2b in QMenu::event(QEvent*) () from /usr/lib/libQtGui.so.4
#55 0x00007f1d3c7ee534 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#56 0x00007f1d3c7f373a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#57 0x00007f1d3db91ed6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#58 0x00007f1d3d6458bc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#59 0x00007f1d3c7ef535 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#60 0x00007f1d3c86bfd4 in ?? () from /usr/lib/libQtGui.so.4
#61 0x00007f1d3c86a499 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#62 0x00007f1d3c891e24 in ?? () from /usr/lib/libQtGui.so.4
#63 0x00007f1d3d644c62 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#64 0x00007f1d3d644e9c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#65 0x00007f1d3d6493eb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#66 0x00007f1d362eac25 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/user/Apps/Koffice/src/koffice/krita/main.cc:49
#67 0x0000000000406b93 in _start ()

Reported using DrKonqi



---- Additional Comments From bugsbane@gmail.com 2010-05-19 06:59:24 ----

Created an attachment
SVG from Blender which crashes Krita on import



---- Additional Comments From boud@valdyas.org 2010-05-19 08:55:33 ----

The crash is actually an assert inside KOffice's core flake library. Krita cannot load .svg directly, I think think it's converted to .odg first -- and if that would succeed, it might be converted to something else again, since I doubt it will be imported as a vector layer at the moment. I'm fairly sure we actually use Karbon's svg filter in this procedure.



---- Additional Comments From cyb@lepi.org 2010-11-21 11:55:14 ----

I get the assert when opening with karbon as well.



---- Additional Comments From zander@kde.org 2010-11-21 12:50:19 ----

Cyrille; is the crash you get in karbon also showing this in the backtrace;
 koffice/filters/karbon/png/PngExport.cpp:70

either way; I suggest re-assigning to karbon filters.



---- Additional Comments From cyb@lepi.org 2010-11-21 14:55:08 ----

Nope, here is the backtrace:

#0  0x00007ffff19a0165 in *__GI_raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff19a2f70 in *__GI_abort () at abort.c:92
#2  0x00007ffff2ceef8f in qt_message_output (msgType=QtFatalMsg, 
    buf=<value optimized out>) at global/qglobal.cpp:2259
#3  0x00007ffff2cef132 in qt_message (msgType=QtFatalMsg, 
    msg=0x7ffff2e4f708 "ASSERT: \"%s\" in file %s, line %d", ap=0x7fffffffc7a0)
    at global/qglobal.cpp:2305
#4  0x00007ffff2cef2e5 in qFatal (msg=0x7811 <Address 0x7811 out of bounds>)
    at global/qglobal.cpp:2488
#5  0x00007ffff692135c in KoRTree<KoShape*>::splitNode (this=<value optimized out>, 
    node=0x3b25328)
    at /home/cyrille/Projects/kde4/src/koffice/libs/flake/KoRTree.h:562
#6  0x00007ffff6922839 in KoRTree<KoShape*>::insertHelper (this=0x3b1f600, 
    bb=<value optimized out>, data=@0x7fffffffca78, id=4)
    at /home/cyrille/Projects/kde4/src/koffice/libs/flake/KoRTree.h:388
#7  0x00007ffff6918efa in KoShapeManager::addShape (this=0x3b24fa0, shape=0xad9f30, 
    repaint=KoShapeManager::PaintShapeOnAdd)
    at /home/cyrille/Projects/kde4/src/koffice/libs/flake/KoShapeManager.cpp:220
#8  0x00007ffff69191a5 in KoShapeManager::setShapes (this=0x3b24fa0, shapes=..., 
    repaint=KoShapeManager::PaintShapeOnAdd)
    at /home/cyrille/Projects/kde4/src/koffice/libs/flake/KoShapeManager.cpp:208
#9  0x00007ffff79c1133 in KarbonCanvas (this=0x3b3db80, p=<value optimized out>)
    at /home/cyrille/Projects/kde4/src/koffice/karbon/ui/widgets/KarbonCanvas.cpp:92
#10 0x00007ffff79ad75b in KarbonView (this=0xb085c0, p=0x7d2e60, 
    parent=<value optimized out>, __in_chrg=<value optimized out>, 
    __vtt_parm=<value optimized out>)
    at /home/cyrille/Projects/kde4/src/koffice/karbon/ui/KarbonView.cpp:200
#11 0x00007ffff79a2e9e in KarbonPart::createViewInstance (this=0x7d2e60, 
    parent=<value optimized out>)
    at /home/cyrille/Projects/kde4/src/koffice/karbon/ui/KarbonPart.cpp:170
#12 0x00007ffff745bc0a in KoDocument::createView (this=0x7811, parent=0x7811)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoDocument.cpp:428
#13 0x00007ffff7489a29 in KoMainWindow::setRootDocument (this=0x743a70, doc=0x7d2e60)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoMainWindow.cpp:464
#14 0x00007ffff748c7af in KoMainWindow::slotLoadCompleted (this=0x743a70)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoMainWindow.cpp:714
#15 0x00007ffff74901f0 in KoMainWindow::qt_metacall (this=0x743a70, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffffffd100)
    at /home/cyrille/Projects/kde4/build/koffice/libs/main/KoMainWindow.moc:169
#16 0x00007ffff2e016d7 in QMetaObject::activate (sender=0x7d2e60, 
    m=<value optimized out>, local_signal_index=<value optimized out>, 
    argv=0xffffffffffffffff) at kernel/qobject.cpp:3280
#17 0x00007ffff71ac315 in KParts::ReadOnlyPart::openUrl (this=0x7d2e60, 
    url=<value optimized out>) at ../../kparts/part.cpp:560
#18 0x00007ffff7465acc in KoDocument::openUrl (this=0x7d2e60, _url=...)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoDocument.cpp:1251

#19 0x00007ffff74881ef in KoMainWindow::openDocumentInternal (this=0x743a70, url=..., 
    newdoc=0x7d2e60)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoMainWindow.cpp:679
#20 0x00007ffff74892c2 in KoMainWindow::openDocument (this=0x743a70, newdoc=0x7d2e60, 
    url=...) at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoMainWindow.cpp:662
#21 0x00007ffff7454632 in KoApplication::start (this=<value optimized out>)
    at /home/cyrille/Projects/kde4/src/koffice/libs/main/KoApplication.cpp:252
#22 0x00007ffff7bddf46 in kdemain (argc=<value optimized out>, 
    argv=<value optimized out>)
    at /home/cyrille/Projects/kde4/src/koffice/karbon/main.cc:47
#23 0x00007ffff198cc4d in __libc_start_main (main=<value optimized out>, 
    argc=<value optimized out>, ubp_av=<value optimized out>, 
    init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffffffdea8) at libc-start.c:228
#24 0x0000000000400829 in _start ()

I am unconvinced that the bug is in karbon, there is little evidence for that at the moment.



---- Additional Comments From zander@kde.org 2010-11-21 16:06:53 ----

The backtrace in the context of this bug tells me that the boundingrect of a KoPathShape was invalid (likely containing NaN).
There are two ways this can happen; one is the shape was manipulated (sheared etc) incorrectly from flake or other code. With values that were NaN.
The other is that the karbon SVG parser is doing something wrong. see koffice/filters/karbon/svg/SvgParser.cpp 

I'm placing my bets on the latter.  Anyone investigating will want to check calls to KoShape::setTransformation and check if the argument is a valid transform.
For example by doing;

#include <qnumeric.h> 
QPointF p = matrix.map(QPointF(10, 100));
Q_ASSERT(!(qIsNaN(p.x()) || qIsNaN(p.y())));



--- Bug imported by faure@kde.org 2010-12-17 19:42  ---

This bug was previously known as bug 238128.

Imported an attachment (id=54897)

The original submitter of attachment 54897 [details] is unknown.
   Reassigning to the person who moved it here: faure@kde.org.

Comment 1 T Zachmann 2012-04-16 05:54:29 UTC
Git commit 79995f56cd67834a57f107c09e95d5494b2982f0 by Thorsten Zachmann.
Committed on 16/04/2012 at 07:49.
Pushed by zachmann into branch 'master'.

Fix crash in loading svg file from blender

The svg file blender writes out contains a viewBox with wrong content

<svg width="2048px" height="2048px" viewBox="0px 0px 2048px 2048px"
     xmlns="http://www.w3.org/2000/svg" version="1.1">

Workaround the bug by removing the px from the viewBox string before loading
the viewBox values.

M  +4    -0    libs/flake/svg/SvgUtil.cpp

http://commits.kde.org/calligra/79995f56cd67834a57f107c09e95d5494b2982f0
Comment 2 T Zachmann 2012-04-16 06:01:43 UTC
Git commit dbd45914ec7be2f67bd1feb030bfda58c3860754 by Thorsten Zachmann.
Committed on 16/04/2012 at 07:49.
Pushed by zachmann into branch 'calligra/2.4'.

Fix crash in loading svg file from blender

The svg file blender writes out contains a viewBox with wrong content

<svg width="2048px" height="2048px" viewBox="0px 0px 2048px 2048px"
     xmlns="http://www.w3.org/2000/svg" version="1.1">

Workaround the bug by removing the px from the viewBox string before loading
the viewBox values.
Reviewed by: boemann
(cherry picked from commit 79995f56cd67834a57f107c09e95d5494b2982f0)

M  +4    -0    libs/flake/svg/SvgUtil.cpp

http://commits.kde.org/calligra/dbd45914ec7be2f67bd1feb030bfda58c3860754