Created attachment 151600 [details] Krita system information SUMMARY *** NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols. See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports *** Seems to be an issue when first copying, and pasting a layer that happens to have a local selection attached to it. Upon pasting the layer into a group or something similar, krita hard crashes. Furthermore, cutting/copying a local selection to a new layer results in a crash duplicating these layers works fine however. STEPS TO REPRODUCE 1. Create new image file 2. create a local selection layer attached to a paint layer 3. copy the paint layer with the attached local selection and paste it OBSERVED RESULT Krita crashes shortly after attempting to paste the layer, be it into a group or elsewhere EXPECTED RESULT Krita should just paste the local selection mask/layer with attached mask SOFTWARE/OS VERSIONS Windows: Windows 10 Pro version 21H2 ADDITIONAL INFORMATION Trying to copy and paste selection masks on their own result in the same behavior. Attached is the crash log, and my system information
Created attachment 151601 [details] Crash log for the relevant crashes Furthermore, i'd like to mention that this issue seemed to be absent on version 5.0.5
Can confirm on 5.1.0 and recent 5.2.x. Detailed backtrace from my 5.2.x build; looks like rhs.image() is probably null... Qt5Core.dll!QObject::thread+0x0 libkritaimage.dll!KisSelectionMask::KisSelectionMask+0xcb [C:/mysrcdir/libs/image/kis_selection_mask.cpp @ 76] 74: 75: connect(m_d->updatesCompressor, SIGNAL(timeout()), SLOT(slotSelectionChangedCompressed())); > 76: this->moveToThread(rhs.image()->thread()); 77: 78: connect(KisImageConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged())); libkritaimage.dll!KisSelectionMask::clone+0x25 [C:/mybuilddir/libs/image/kritaimage_autogen/include/../../../../../src/libs/image/kis_selection_mask.h @ 39] 37: 38: KisNodeSP clone() const override { > 39: return KisNodeSP(new KisSelectionMask(*this)); 40: } 41: libkritaimage.dll!KisNode::KisNode+0x11f [C:/mysrcdir/libs/image/kis_node.cpp @ 192] 190: KisSafeReadNodeList::const_iterator iter; 191: FOREACH_SAFE(iter, rhs.m_d->nodes) { > 192: KisNodeSP child = (*iter)->clone(); 193: child->createNodeProgressProxy(); 194: m_d->nodes.append(child); libkritaimage.dll!KisLayer::KisLayer+0x14 [C:/mysrcdir/libs/image/kis_layer.cc @ 195] 193: 194: KisLayer::KisLayer(const KisLayer& rhs) > 195: : KisNode(rhs) 196: , m_d(new Private(this)) 197: { libkritaimage.dll!KisPaintLayer::KisPaintLayer+0x18 [C:/mysrcdir/libs/image/kis_paint_layer.cc @ 90] 88: 89: KisPaintLayer::KisPaintLayer(const KisPaintLayer& rhs) > 90: : KisLayer(rhs) 91: , KisIndirectPaintingSupport() 92: , m_d(new Private) libkritaimage.dll!KisPaintLayer::clone+0x25 [C:/mybuilddir/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../src/libs/image/kis_paint_layer.h @ 66] 64: 65: KisNodeSP clone() const override { > 66: return KisNodeSP(new KisPaintLayer(*this)); 67: } 68: libkritaui.dll!(anonymous namespace)::safeCopyNode+0x97 [C:/mysrcdir/libs/ui/kis_mimedata.cpp @ 50] 48: KisCloneLayerSP cloneLayer = dynamic_cast<KisCloneLayer*>(node.data()); 49: return cloneLayer && detachClones ? > 50: KisNodeSP(cloneLayer->reincarnateAsPaintLayer()) : node->clone(); 51: } 52: } libkritaui.dll!KisMimeData::tryLoadInternalNodes+0x732 [C:/mysrcdir/libs/ui/kis_mimedata.cpp @ 281] 279: QList<KisNodeSP> clones; 280: Q_FOREACH (KisNodeSP node, nodes) { > 281: node = safeCopyNode(node, sourceImage != image); 282: if ((forceCopy || copyNode) && sourceImage == image) { 283: KisLayerUtils::addCopyOfNameTag(node); libkritaui.dll!KisMimeData::loadNodesFast+0x45 [C:/mysrcdir/libs/ui/kis_mimedata.cpp @ 409] 407: { 408: QList<KisNodeSP> nodes = > 409: KisMimeData::tryLoadInternalNodes(data, 410: image, 411: shapeController, libkritaui.dll!KisMimeData::insertMimeLayers+0x63 [C:/mysrcdir/libs/ui/kis_mimedata.cpp @ 451] 449: QPointF offset) 450: { > 451: QList<KisNodeSP> nodes = loadNodesFast(data, image, shapeController, copyNode /* IN-OUT */); 452: 453: if (changeOffset) { libkritaui.dll!KisNodeManager::pasteLayersFromClipboard+0x1ed [C:/mysrcdir/libs/ui/kis_node_manager.cpp @ 1492] 1490: KisNodeDummy *aboveThisDummy = parentDummy ? parentDummy->lastChild() : 0; 1491: > 1492: KisMimeData::insertMimeLayers(data, 1493: image, 1494: shapeController,
Git commit 4b53f48da5bfe3f1a8ac902fe722c86ead011df9 by Dmitry Kazakov. Committed on 16/09/2022 at 14:02. Pushed by dkazakov into branch 'master'. Fix a crash when copying a layer with selection masks The is no need to call moveToThread in KisSelectionMask's ctor because every node is moved in the ctor of KisNode M +0 -2 libs/image/kis_selection_mask.cpp https://invent.kde.org/graphics/krita/commit/4b53f48da5bfe3f1a8ac902fe722c86ead011df9
Git commit 5df0cc573dd768db6c01ab7be14e6cdd4165cd6d by Dmitry Kazakov. Committed on 16/09/2022 at 14:03. Pushed by dkazakov into branch 'krita/5.1'. Fix a crash when copying a layer with selection masks The is no need to call moveToThread in KisSelectionMask's ctor because every node is moved in the ctor of KisNode (cherry picked from commit 4b53f48da5bfe3f1a8ac902fe722c86ead011df9) M +0 -2 libs/image/kis_selection_mask.cpp https://invent.kde.org/graphics/krita/commit/5df0cc573dd768db6c01ab7be14e6cdd4165cd6d
*** Bug 460799 has been marked as a duplicate of this bug. ***