Bug 389271 - "Ctrl-C" on single object in vector layer crashes: "UnavailShapeID cannot be cloned"
Summary: "Ctrl-C" on single object in vector layer crashes: "UnavailShapeID cannot be ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layers/Vector (show other bugs)
Version: 4.0.0-beta.1
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: release_blocker, triaged
Depends on:
Blocks:
 
Reported: 2018-01-21 05:06 UTC by Matt
Modified: 2018-02-02 16:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
example svg that causes crash (5.83 KB, image/svg+xml)
2018-01-21 05:06 UTC, Matt
Details
Full log from terminal (65.23 KB, text/x-log)
2018-01-22 04:42 UTC, Matt
Details
(GDB Report) (5.06 KB, text/plain)
2018-01-22 10:48 UTC, mvowada
Details
test kra file (71.88 KB, application/x-krita)
2018-01-31 15:26 UTC, Halla Rempt
Details
file with a text shape (110.96 KB, application/x-krita)
2018-02-01 12:12 UTC, Halla Rempt
Details
2 shapes (230.56 KB, application/x-krita)
2018-02-01 17:45 UTC, Halla Rempt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt 2018-01-21 05:06:34 UTC
Created attachment 110026 [details]
example svg that causes crash

100% reproducible for me.

I have a single object imported from an SVG in a vector layer.  When selecting the object and pressing "Ctrl-C" to copy, krita crashes.

Error on console:
SAFE ASSERT (krita): "0 && "not implemented!"" in file /krita-4.0.0.51/libs/flake/KoShape.cpp, line 315
"UnavailShapeID" cannot be cloned

steps:
create new file
create vector layer
import vector object into vector layer
select vector object
Ctrl-C
crash!

I have included one svg that causes a crash, but I have tried with a few and they all cause a crash.

Note:
I'm not sure where KoShape.cpp is.  Not familiar enough with appimages to understand where files could be.
Comment 1 mvowada 2018-01-21 14:48:52 UTC
Hi matt, how do you imported the vector object into the vector layer exactly. Asking because it seems I'm not able to reproduce this with Krita 4.0.0-beta1.1.appimage.
Comment 2 Matt 2018-01-22 04:42:42 UTC
Created attachment 110040 [details]
Full log from terminal
Comment 3 Matt 2018-01-22 04:43:29 UTC
Hi, sorry for slowness getting back to you.

Steps:

1) I add the docker "Add Shape"
2) I select the blue "vector" object from the "add shape" docker
3) I drag that to the canvas
4) on the pop-up window, I click on the button
5) I self my file using the picker and hit ok.
6) I wiggle the svg around, all good
7) I deselect then select the svg onject again
8) Ctrl-C, boom.


Here's a vid:
https://youtu.be/Ar0LYqgPaV8

When the app crashes, it's exactly when I hit "Ctrl-C".  The terminal says segfault.  

Attached is the generated log, however, there is noise.  
- libpng errors seem benign based on what I can tell and were present in 3.3.1
- QIcon is not clear to me, this didn't happen in 3.3.1 but i cann't find the right version of the file to debug. look like missing theme.  Not sure if that's me or appimage.  I do have QTQuick installed on my machine.
Comment 4 mvowada 2018-01-22 10:48:31 UTC
Created attachment 110044 [details]
(GDB Report)

Hi, matt, and thank you very much for the clear steps.

I can easily reproduce this bug on Ubuntu 14.04 - Krita 4.0.0-beta1.1.appimage
Comment 5 mvowada 2018-01-22 10:48:57 UTC
(confirming)
Comment 6 Halla Rempt 2018-01-22 14:41:11 UTC
hread 1 (Thread 0x7f2062d71940 (LWP 32424)):
[KCrash Handler]
#6  0x00007f20603844c6 in SvgWriter::saveGeneric (this=0x7ffc48833780, shape=0x0, context=...) at /home/boud/dev/krita/libs/flake/svg/SvgWriter.cpp:241
#7  0x00007f206038571e in SvgWriter::saveShapes (this=this@entry=0x7ffc48833780, shapes=..., savingContext=...) at /home/boud/dev/krita/libs/flake/svg/SvgWriter.cpp:164
#8  0x00007f20603859b0 in SvgWriter::save (this=this@entry=0x7ffc48833780, outputDevice=..., pageSize=...) at /home/boud/dev/krita/libs/flake/svg/SvgWriter.cpp:122
#9  0x00007f206031b9d4 in KoDrag::setSvg (this=this@entry=0x7ffc48833810, originalShapes=...) at /home/boud/dev/krita/libs/flake/KoDrag.cpp:82
#10 0x00007f2033f94a86 in DefaultTool::copy (this=<optimized out>) at /home/boud/dev/krita/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp:885
#11 0x00007f20626123fa in KisCutCopyActionFactory::run (this=this@entry=0x7ffc48833990, willCut=willCut@entry=false, makeSharpClip=makeSharpClip@entry=false, view=0x67728f0) at /home/boud/dev/krita/libs/ui/actions/kis_selection_action_factories.cpp:272
#12 0x00007f20624c10e9 in KisSelectionManager::copy (this=0x695aab0) at /home/boud/dev/krita/libs/ui/kis_selection_manager.cc:351
#13 0x00007f20584203df in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#14 0x00007f20593021f2 in QAction::triggered(bool) () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007f20593049bd in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQt5Widgets.so.5
#16 0x00007f2059304b84 in QAction::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007f205930871c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#18 0x00007f205930f500 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#19 0x00007f20626572e7 in KisApplication::notify (this=<optimized out>, receiver=0x676ab40, event=0x7ffc48833e40) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:600
#20 0x00007f20583f6115 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#21 0x00007f205898f97f in QShortcutMap::dispatchEvent(QKeyEvent*) () from /usr/lib64/libQt5Gui.so.5
#22 0x00007f205898fa44 in QShortcutMap::tryShortcut(QKeyEvent*) () from /usr/lib64/libQt5Gui.so.5
#23 0x00007f2058948048 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /usr/lib64/libQt5Gui.so.5
#24 0x00007f20589611f7 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib64/libQt5Gui.so.5
#25 0x00007f2058965c25 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#26 0x00007f20589446bb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#27 0x00007f204bf6ec9b in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5XcbQpa.so.5
#28 0x00007f20583f483b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#29 0x00007f20583fcef4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#30 0x0000000000405ec7 in main (argc=1, argv=<optimized out>) at /home/boud/dev/krita/krita/main.cc:312
Comment 7 Halla Rempt 2018-01-22 14:48:27 UTC
Git commit 5c23a48d2cd1a553887c827baddfda42e3189008 by Boudewijn Rempt.
Committed on 22/01/2018 at 14:46.
Pushed by rempt into branch 'master'.

Remove the Add Shape Docker

This docker is extremely dangerous these days because it can
be used to create ODF based shapes that cannot be saved or
copied. Note that when loading Krita 3 files with vector layers
that contain vector shapes or text shapes or other shapes for
which we don't have a clone() methods defined, this assert

SAFE ASSERT (krita): "0 && "not implemented!"" in file /krita-4.0.0.51/libs/flake/KoShape.cpp, line 315

Will still fire: we need to make sure this cannot happen before
we release.

M  +0    -1    plugins/dockers/CMakeLists.txt
D  +0    -20   plugins/dockers/shapedockers/CMakeLists.txt
D  +0    -134  plugins/dockers/shapedockers/CollectionItemModel.cpp
D  +0    -77   plugins/dockers/shapedockers/CollectionItemModel.h
D  +0    -39   plugins/dockers/shapedockers/Plugin.cpp
D  +0    -34   plugins/dockers/shapedockers/Plugin.h
D  +0    -171  plugins/dockers/shapedockers/ShapeCollectionDocker.cpp
D  +0    -77   plugins/dockers/shapedockers/ShapeCollectionDocker.h
D  +0    -249  plugins/dockers/shapedockers/SvgSymbolCollectionDocker.cpp
D  +0    -88   plugins/dockers/shapedockers/SvgSymbolCollectionDocker.h
D  +0    -42   plugins/dockers/shapedockers/WdgSvgCollection.ui
D  +0    -11   plugins/dockers/shapedockers/calligra_docker_defaults.json

https://commits.kde.org/krita/5c23a48d2cd1a553887c827baddfda42e3189008
Comment 8 Halla Rempt 2018-01-31 15:26:00 UTC
Created attachment 110264 [details]
test kra file
Comment 9 Halla Rempt 2018-02-01 12:12:30 UTC
Created attachment 110279 [details]
file with a text shape

It will load in krita 4 with the old text shape and be editable with the old text tool, but it will not be saved.
Comment 10 Halla Rempt 2018-02-01 17:45:27 UTC
Created attachment 110289 [details]
2 shapes
Comment 11 Dmitry Kazakov 2018-02-01 21:57:34 UTC
Git commit 603c9a0c7f19d6386bf496cd12c152a1f6acd087 by Dmitry Kazakov.
Committed on 01/02/2018 at 21:57.
Pushed by dkazakov into branch 'master'.

Fix loading of SVGs embedded into ODG by Krita 3.0

This patch basically deprecates KoUnavailShape and tries to load
the embedded SVGs directly. Theoretically, some raster images could
also be included into ODG document and handled by unavail-shape, but
most probably it has never been used, because ImageShape was always
disabled in 3.x

M  +0    -1    libs/flake/CMakeLists.txt
M  +265  -47   libs/flake/KoShapeRegistry.cpp
D  +0    -629  libs/flake/KoUnavailShape.cpp
D  +0    -76   libs/flake/KoUnavailShape.h
M  +39   -21   libs/flake/svg/SvgShapeFactory.cpp
M  +3    -0    libs/flake/svg/SvgShapeFactory.h
M  +71   -0    libs/flake/tests/TestKoShapeRegistry.cpp
M  +1    -1    libs/flake/tests/TestKoShapeRegistry.h
A  +-    --    libs/flake/tests/data/odf_frame_resource_store.zip
M  +8    -0    libs/ui/KisDocument.cpp
M  +11   -0    libs/ui/KisDocument.h
M  +4    -0    plugins/impex/kra/kra_converter.cpp

https://commits.kde.org/krita/603c9a0c7f19d6386bf496cd12c152a1f6acd087
Comment 12 Dmitry Kazakov 2018-02-02 16:01:25 UTC
Git commit 5cdb9a4fcf225b9da501f1fdedb5ce9b832741ab by Dmitry Kazakov.
Committed on 02/02/2018 at 16:00.
Pushed by dkazakov into branch 'master'.

Implement cloning of a TextShape

The shape itself is cloned correctly now. But it is still not
saved correctly into SVG. It looks like QSvgGenerator writes wrong
font height for some reason.

At least there are no crashes atm

M  +10   -1    libs/flake/KoFrameShape.cpp
M  +5    -0    libs/flake/KoFrameShape.h
M  +31   -1    plugins/flake/textshape/TextShape.cpp
M  +4    -0    plugins/flake/textshape/TextShape.h
M  +5    -1    plugins/flake/textshape/textlayout/KoTextShapeData.cpp

https://commits.kde.org/krita/5cdb9a4fcf225b9da501f1fdedb5ce9b832741ab
Comment 13 Dmitry Kazakov 2018-02-02 16:01:25 UTC
Git commit 4934b7e38a3a3cad3af06c2fe60e0578b04aed61 by Dmitry Kazakov.
Committed on 02/02/2018 at 10:34.
Pushed by dkazakov into branch 'master'.

Remove AnnotationTextShape and (almost) everything related to it

D  +0    -173  plugins/flake/textshape/AnnotationTextShape.cpp
D  +0    -88   plugins/flake/textshape/AnnotationTextShape.h
D  +0    -135  plugins/flake/textshape/AnnotationTextShapeFactory.cpp
D  +0    -39   plugins/flake/textshape/AnnotationTextShapeFactory.h
M  +1    -38   plugins/flake/textshape/CMakeLists.txt
D  +0    -98   plugins/flake/textshape/ChangeTracker.cpp
D  +0    -50   plugins/flake/textshape/ChangeTracker.h
D  +0    -394  plugins/flake/textshape/ReferencesTool.cpp
D  +0    -136  plugins/flake/textshape/ReferencesTool.h
D  +0    -46   plugins/flake/textshape/ReferencesToolFactory.cpp
D  +0    -34   plugins/flake/textshape/ReferencesToolFactory.h
D  +0    -127  plugins/flake/textshape/ReviewTool.cpp
D  +0    -72   plugins/flake/textshape/ReviewTool.h
D  +0    -51   plugins/flake/textshape/ReviewToolFactory.cpp
D  +0    -34   plugins/flake/textshape/ReviewToolFactory.h
M  +0    -6    plugins/flake/textshape/TextPlugin.cpp
M  +2    -29   plugins/flake/textshape/TextTool.cpp
M  +1    -2    plugins/flake/textshape/TextToolFactory.cpp
D  +0    -164  plugins/flake/textshape/dialogs/CitationInsertionDialog.cpp
D  +0    -47   plugins/flake/textshape/dialogs/CitationInsertionDialog.h
D  +0    -609  plugins/flake/textshape/dialogs/CitationInsertionDialog.ui
D  +0    -169  plugins/flake/textshape/dialogs/InsertBibliographyDialog.cpp
D  +0    -56   plugins/flake/textshape/dialogs/InsertBibliographyDialog.h
D  +0    -276  plugins/flake/textshape/dialogs/InsertBibliographyDialog.ui
D  +0    -299  plugins/flake/textshape/dialogs/LinkInsertionDialog.cpp
D  +0    -84   plugins/flake/textshape/dialogs/LinkInsertionDialog.h
D  +0    -218  plugins/flake/textshape/dialogs/LinkInsertionDialog.ui
D  +0    -55   plugins/flake/textshape/dialogs/ManageBookmark.ui
D  +0    -177  plugins/flake/textshape/dialogs/ManageBookmarkDialog.cpp
D  +0    -76   plugins/flake/textshape/dialogs/ManageBookmarkDialog.h
D  +0    -235  plugins/flake/textshape/dialogs/NotesConfigurationDialog.cpp
D  +0    -60   plugins/flake/textshape/dialogs/NotesConfigurationDialog.h
D  +0    -352  plugins/flake/textshape/dialogs/NotesConfigurationDialog.ui
D  +0    -13   plugins/flake/textshape/dialogs/SimpleAnnotationWidget.cpp
D  +0    -26   plugins/flake/textshape/dialogs/SimpleAnnotationWidget.h
D  +0    -64   plugins/flake/textshape/dialogs/SimpleAnnotationWidget.ui
D  +0    -40   plugins/flake/textshape/dialogs/SimpleCaptionsWidget.cpp
D  +0    -52   plugins/flake/textshape/dialogs/SimpleCaptionsWidget.h
D  +0    -82   plugins/flake/textshape/dialogs/SimpleCaptionsWidget.ui
D  +0    -127  plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.cpp
D  +0    -68   plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.h
D  +0    -80   plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.ui
D  +0    -48   plugins/flake/textshape/dialogs/SimpleFootEndNotesWidget.cpp
D  +0    -46   plugins/flake/textshape/dialogs/SimpleFootEndNotesWidget.h
D  +0    -88   plugins/flake/textshape/dialogs/SimpleFootEndNotesWidget.ui
D  +0    -94   plugins/flake/textshape/dialogs/SimpleLinksWidget.cpp
D  +0    -53   plugins/flake/textshape/dialogs/SimpleLinksWidget.h
D  +0    -90   plugins/flake/textshape/dialogs/SimpleLinksWidget.ui
D  +0    -38   plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.cpp
D  +0    -43   plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.h
D  +0    -54   plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.ui
D  +0    -125  plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.cpp
D  +0    -68   plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.h
D  +0    -95   plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.ui
D  +0    -109  plugins/flake/textshape/dialogs/SpecialButton.cpp
D  +0    -49   plugins/flake/textshape/dialogs/SpecialButton.h
D  +0    -160  plugins/flake/textshape/dialogs/StylesWidget.cpp
D  +0    -77   plugins/flake/textshape/dialogs/StylesWidget.h
D  +0    -28   plugins/flake/textshape/dialogs/StylesWidget.ui

https://commits.kde.org/krita/4934b7e38a3a3cad3af06c2fe60e0578b04aed61