Bug 461556 - Adding a reference image via tool option or drag and drop crashes krita (git 4225dad)
Summary: Adding a reference image via tool option or drag and drop crashes krita (git ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Reference Images (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
: 461699 461706 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-07 17:30 UTC by Raghavendra kamath
Modified: 2022-11-11 17:45 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raghavendra kamath 2022-11-07 17:30:14 UTC
SUMMARY
Dragging and dropping an image to add it as a reference image crashes krita. It also crashes when I got to add reference image via the tool options of the reference image tool.

STEPS TO REPRODUCE
1. Open a new document and drag and drop an image and choose insert as reference image.

Alternatively
1.  Open a new document select the reference image tool and got to tool option docker.
2. Click on the plus icon to add a reference image. Then choose a png or jpg image

OBSERVED RESULT
Krita crashes on choosing and image

EXPECTED RESULT
A reference image should be added without crashing krita
Comment 1 Freya Lupen 2022-11-07 20:17:21 UTC
Confirmed on same git hash. Backtrace:
>* thread #1, stop reason = Exception 0xc0000005 encountered at address 0x7ff9413198f8: Access violation reading location 0x00000020
> * frame #0: 0x00007ff9413198f8 libkritaimage.dll`KisPaintDevice::setDefaultBounds(this=0x0000000000000000, defaultBounds=KisDefaultBoundsBaseSP @ 0x0000003a46d5ab50) at kis_paint_device.cc:1223:5
>    frame #1: 0x00007ff949a7e92c libkritaui.dll`KisShapeLayer::setImage(this=<unavailable>, _image=<unavailable>) at kis_shape_layer.cc:287:23
>    frame #2: 0x00007ff941310f0d libkritaimage.dll`KisNode::add(this=0x000001f2c1603dc0, newNode=KisNodeSP @ 0x0000003a46d5ac70, aboveThis=<unavailable>) at kis_node.cpp:502:14
>    frame #3: 0x00007ff94131531a libkritaimage.dll`KisNodeFacade::addNode(this=0x000001f2ee8fd280, node=KisNodeSP @ 0x0000003a46d5ad38, parent=<unavailable>) at kis_node_facade.cpp:101:27
>    frame #4: 0x00007ff949e57ffd libkritaui.dll`KisDocument::setReferenceImagesLayer(this=0x000001f2bd5d51b0, layer=KisSharedPtr<KisReferenceImagesLayer> @ 0x0000003a46d5ad98, updateImage=true) at KisDocument.cpp:2589:23
>    frame #5: 0x00007ff949f0311c libkritaui.dll`AddReferenceImagesCommand::redo(this=0x000001f2ee810f70) at KisReferenceImagesLayer.cpp:33:25
>    frame #6: 0x00007ff97d3d2e12 libkritacommand.dll`KUndo2Command::redo(this=0x000001f2ee6169a0) at kundo2stack.cpp:224:30
>    frame #7: 0x00007ff97d3d34a7 libkritacommand.dll`KUndo2Command::redoMergedCommands(this=0x000001f2ee6169a0) at kundo2stack.cpp:407:5
>    frame #8: 0x00007ff97d3d4372 libkritacommand.dll`KUndo2QStack::push(this=0x000001f2ee5410c0, cmd=0x000001f2ee6169a0) at kundo2stack.cpp:720:10
>    frame #9: 0x00007ff94137f85c libkritaimage.dll`KisLegacyUndoAdapter::addCommand(this=0x000001f2ee87a700, command=0x000001f2ee6169a0) at kis_legacy_undo_adapter.cpp:39:22
>    frame #10: 0x00007ff949993e42 libkritaui.dll`KisCanvas2::addCommand(this=<unavailable>, command=0x000001f2ee6169a0) at kis_canvas2.cpp:434:40
>    frame #11: 0x00007ff949db6a3d libkritaui.dll`KisPasteReferenceActionFactory::run(this=<unavailable>, viewManager=<unavailable>) at KisPasteActionFactories.cpp:380:17
>    frame #12: 0x00007ff949b9e3c4 libkritaui.dll`KisSelectionManager::pasteAsReference(this=0x000001f2bd4a9768) at kis_selection_manager.cc:377:13
Comment 2 amyspark 2022-11-07 21:09:36 UTC
I think this regressed in https://invent.kde.org/graphics/krita/-/commit/82ac6fa60f846d8e8783118ef594def07b968654, because I don't see any actual initialization of m_d->paintDevice.
Comment 3 Raghavendra kamath 2022-11-11 05:44:08 UTC
I noticed that the nightly build hangs when opening images which have reference images embeded.
Comment 4 amyspark 2022-11-11 12:46:36 UTC
*** Bug 461699 has been marked as a duplicate of this bug. ***
Comment 5 Halla Rempt 2022-11-11 12:47:59 UTC
Ah, I couldn't find any crash bug for the reference tool...
Comment 6 Dmitry Kazakov 2022-11-11 12:51:16 UTC
Git commit 673bbd439f42e398eff3330de7bf7f70b211d3ed by Dmitry Kazakov.
Committed on 11/11/2022 at 12:51.
Pushed by dkazakov into branch 'master'.

Fix a crash when adding a reference image

Reference images layer does not have any paint device.

M  +3    -1    libs/ui/flake/kis_shape_layer.cc

https://invent.kde.org/graphics/krita/commit/673bbd439f42e398eff3330de7bf7f70b211d3ed
Comment 7 amyspark 2022-11-11 17:45:26 UTC
*** Bug 461706 has been marked as a duplicate of this bug. ***