Version: (using Devel) OS: Linux Installed from: Compiled sources Here's the BT: Applicazione: Krita (krita), segnale SIGSEGV Thread 1 (Thread 0xb3e006e0 (LWP 26466)): [KCrash Handler] #6 0xb79a146d in Eigen::ei_pstore<double, double __vector> (to=0x97a8648, from=@0xbf8291e0) at /usr/lib/gcc/i486-linux-gnu/4.3.2/include/emmintrin.h:150 #7 0xb79a1760 in Eigen::MatrixBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::copyPacket<Eigen::Matrix<double, 2, 1, 0, 2, 1>, 0, 0> (this=0x97a8648, row=0, col=0, other=@0xbf829320) at /opt/kde/include/eigen2/Eigen/src/Core/Coeffs.h:339 #8 0xb79a1798 in Eigen::ei_assign_innervec_CompleteUnrolling<Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, 0, 2>::run (dst=@0x97a8648, src=@0xbf829320) at /opt/kde/include/eigen2/Eigen/src/Core/Assign.h:166 #9 0xb79a1853 in Eigen::MatrixBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >::lazyAssign<Eigen::Matrix<double, 2, 1, 0, 2, 1> > (this=0x97a8648, other=@0xbf829320) at /opt/kde/include/eigen2/Eigen/src/Core/Assign.h:405 #10 0xb79a0b31 in KisPaintInformation (this=0x97a84e8, pos_=@0xbf829310, pressure_=0.5, xTilt_=0, yTilt_=0, movement_= {<Eigen::MatrixBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >> = {<No data fields>}, <Eigen::ei_with_aligned_operator_new<double, 2, true>> = {<Eigen::WithAlignedOperatorNew> = {<No data fields>}, <No data fields>}, m_storage = {m_data = {array = {1.5874356868555419e-314, 0}}}}, rotation_=0, tangentialPressure_=0) at /usr/src/kde4/koffice/krita/image/brushengine/kis_paint_information.cc:45 #11 0xb7bf327f in KisToolFreehand (this=0x97a84b0, canvas=0x93641f8, cursor=@0xbf829374, transactionText=@0xbf829378) at /usr/src/kde4/koffice/krita/ui/tool/kis_tool_freehand.cc:67 #12 0xa9de90e7 in KisToolSelectEraser (this=0x97a84b0, canvas=0x93641f8) at /usr/src/kde4/koffice/krita/plugins/tools/selectiontools/kis_tool_select_eraser.cc:46 #13 0xa9de38b5 in KisToolSelectEraserFactory::createTool (this=0x82c36a8, canvas=0x93641f8) at /usr/src/kde4/koffice/krita/plugins/tools/selectiontools/kis_tool_select_eraser.h:74 #14 0xb75e2255 in ToolHelper::createTool (this=0x952c5b8, canvas=0x93641f8) at /usr/src/kde4/koffice/libs/flake/KoToolManager_p.cpp:70 #15 0xb75eaaef in KoToolManager::Private::createCanvasData (this=0x91ad920, controller=0x9487470, device={d = 0xbf829564}) at /usr/src/kde4/koffice/libs/flake/KoToolManager.cpp:131 #16 0xb75e57cc in KoToolManager::attachCanvas (this=0x91ad8a0, controller=0x9487470) at /usr/src/kde4/koffice/libs/flake/KoToolManager.cpp:418 #17 0xb75e6542 in KoToolManager::addController (this=0x91ad8a0, controller=0x9487470) at /usr/src/kde4/koffice/libs/flake/KoToolManager.cpp:257 #18 0xb7bfaa02 in KisView2::createGUI (this=0x8946bc8) at /usr/src/kde4/koffice/krita/ui/kis_view2.cpp:464 #19 0xb7bfd57c in KisView2 (this=0x8946bc8, doc=0x82e9580, parent=0x8179ac8) at /usr/src/kde4/koffice/krita/ui/kis_view2.cpp:215 #20 0xb7b78e7f in KisDoc2::createViewInstance (this=0x82e9580, parent=0x8179ac8) at /usr/src/kde4/koffice/krita/ui/kis_doc2.cc:440 #21 0xb7476ad1 in KoDocument::createView (this=0x82e9580, parent=0x8179ac8) at /usr/src/kde4/koffice/libs/main/KoDocument.cpp:338 #22 0xb749fa84 in KoMainWindow::setRootDocument (this=0x82f9290, doc=0x82e9580) at /usr/src/kde4/koffice/libs/main/KoMainWindow.cpp:465 #23 0xb747771c in KoDocument::deleteOpenPane (this=0x82e9580) at /usr/src/kde4/koffice/libs/main/KoDocument.cpp:2632 #24 0xb74822e5 in KoDocument::qt_metacall (this=0x82e9580, _c=QMetaObject::InvokeMetaMethod, _id=23, _a=0xbf8299a8) at /usr/src/kde4/build/koffice/libs/main/KoDocument.moc:132 #25 0xb7b7891b in KisDoc2::qt_metacall (this=0x82e9580, _c=QMetaObject::InvokeMetaMethod, _id=42, _a=0xbf8299a8) at /usr/src/kde4/build/koffice/krita/ui/kis_doc2.moc:81 #26 0xb7e21bd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #27 0xb7e22952 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #28 0xb7e27f27 in ?? () from /usr/lib/libQtCore.so.4 #29 0xb7e2804c in ?? () from /usr/lib/libQtCore.so.4 #30 0xb7e1c6af in QObject::event () from /usr/lib/libQtCore.so.4 #31 0xb5c0279c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4 #32 0xb5c0a61e in QApplication::notify () from /usr/lib/libQtGui.so.4 #33 0xb6832379 in KApplication::notify (this=0xbf82a0c8, receiver=0x830b2c8, event=0xbf829e3c) at /usr/src/kde4/kdelibs/kdeui/kernel/kapplication.cpp:307 #34 0xb7e0d0d1 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4 #35 0xb7e3b031 in ?? () from /usr/lib/libQtCore.so.4 #36 0xb7e37680 in ?? () from /usr/lib/libQtCore.so.4 #37 0xb535b1b8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #38 0xb535e853 in ?? () from /usr/lib/libglib-2.0.so.0 #39 0x081a4298 in ?? () #40 0x00000000 in ?? ()
Er... You're sure this happen when opening a file? Not when you're trying to use the selection eraser tool?
Well. No. When i click on template, Then use this template, krita waits a moment then... crash
Does it make a difference which template you select?
No. I have tried almost all of them. Tried all profiles.
Hm, that's really strange, since that doesn't happen to any of the developers. Which version of eigen are you using? And which distribution, processor type etc.?
I use a debian lenny. Compile with gcc (Debian 4.3.2-1) 4.3.2 -march=core2 (Intel core 2 Duo 2.13GHz) Eigen is from kdesupport(trunk).
Could you try without the march flag? Maybe there's a problem in eigen2 related to that.
This is clearly a bug in Eigen: Explanation: Look at this: #6 0xb79a146d in Eigen::ei_pstore<double, double __vector> (to=0x97a8648, from=@0xbf8291e0) at /usr/lib/gcc/i486-linux-gnu/4.3.2/include/emmintrin.h:150 ei_pstore stores a 128-bit packet at a 128-bit-aligned location in memory. Except that.... the 'to' parameter passed to it here, 0x97a8648, is not a multiple of 128 bits == 16 bytes! (It should end with a 0 in hex!) Now let me scratch my head... And yes if you want a quick & dirty workaround until I fix it, removing the march flag will avoid the crash.
Can you svn up Krita and retry? I think I fixed it in revision 893919. This actually wasn't Eigen's bug, though it is such a tricky aspect of Eigen that I'm ashamed of explaining it =) A KisVector2D (which is Eigen::Vector2d) consists of 2 doubles, which is 128 bits. Which is exactly the size of a SSE packet. So Eigen notices that, and starts using SSE instructions for all sorts of operations on these vectors. But SSE instructions (at least the ones that Eigen uses, which are the fast ones) require 128-bit alignment. Otherwise you get a SIGSEGV as was required here. For this reason, Eigen takes care by itself to require 128-bit alignment for KisVector2D, by doing two things: 1) Eigen requires 128-bit alignment for the KisVector2D's array (of 2 doubles). With GCC, this is done with a __attribute__ ((aligned(16))). 2) Eigen overloads the "operator new" of KisVector2D so it will always return 128-bit aligned pointers. Thus, normally, you don't have to worry about anything, Eigen handles alignment for you.... ... except in one case. When you have a struct like this, struct Foo { double x; KisVector2D v; }; and you construct a new Foo: Foo *f = new Foo; Then, since Foo doesn't have aligned operator new, the pointer foo is not necessarily 128-bit aligned. The alignment attribute of the member v is then relative to the start of the struct, foo. If the foo pointer wasn't aligned, then foo->v won't be aligned either! The solution is to let struct Foo have an aligned operator new. Eigen lets you do this as follows: struct Foo : Eigen::WithAlignedOperatorNew { double x; KisVector2D v; }; I just got an idea, I'll add an assert in KisVector2D's constructor to check for alignment. That hopefully will allow to catch these bugs more systematically :)
SVN commit 893982 by bjacob: Make deluxe assertion with deluxe error message with link to deluxe web page for this very nasty bug (unaligned member in dynamically allocated struct) that our friends at Krita just encountered: http://bugs.kde.org/show_bug.cgi?id=177133 CCBUG:177133 M +11 -0 Eigen/src/Core/util/Memory.h A doc/UnalignedArrayAssert.dox WebSVN link: http://websvn.kde.org/?view=rev&revision=893982
It should be fixed now.
It works. Great work.