Bug 434015 - Crash due to colorspace conversion after paste
Summary: Crash due to colorspace conversion after paste
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: Color models (other bugs)
Version First Reported In: 4.4.2
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 14:53 UTC by Paolo Amadini
Modified: 2021-12-01 23:01 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Amadini 2021-03-05 14:53:57 UTC
SUMMARY

I found this crash while testing <https://invent.kde.org/graphics/krita/-/merge_requests/732>. It seems to be related to the colorspace conversion after paste, and is triggered at some point if this "convertTo" call has been invoked before:

https://invent.kde.org/graphics/krita/-/blob/589911494cce6af4c49180fbfcee959d190eaf1a/libs/ui/kis_import_catcher.cc#L134

It happens both on version 4.4.2 and on git master.

STEPS TO REPRODUCE
1. Tick the following setting under "General > Miscellaneous":
   "On importing images as layers, convert to the image colorspace"
2. Create a new fill layer, mask, or other layer type with alpha only
3. Select an area of the image
4. Copy the selection with the layer or mask still selected
5. Paste the selection (Ctrl+V)
Comment 1 Halla Rempt 2021-03-08 10:41:34 UTC
Ah, isn't this just the copy an empty layer issue that I fixed already?
Comment 2 Paolo Amadini 2021-03-08 11:02:58 UTC
(In reply to Halla Rempt from comment #1)
> Ah, isn't this just the copy an empty layer issue that I fixed already?

This happens regardless of whether the layer is empty, and it was reproducible on a recent git master branch, so I believe it's not related.

In my tests, this bug seems limited to the case where the image being pasted has the "Alpha Mask" colorspace. I just tried to paste the image as a new document before step 5, convert it to the "Grayscale/Aplha" colorspace, then copy and paste it in the original document, and it doesn't crash.
Comment 3 amyspark 2021-09-03 16:03:35 UTC
Copying and pasting with the mask layer selected results in an instant crash on commit 91bbbd5ffd. 

ASSERT (krita): "hash != KeyTraits::NullHash" in file E:\krita-win\src\libs\image\3rdparty\lock_free_map\leapfrog.h, line 161

Qt5Core.dll!00007ffa5a053f98() (Origen desconocido:0)
Qt5Core.dll!00007ffa5a0522dd() (Origen desconocido:0)
kritaglobal.dll!kis_assert_common(const char * assertion, const char * file, int line, bool throwException, bool isIgnorable) Line 89 (e:\krita-win\src\libs\global\kis_assert.cpp:89)
kritaglobal.dll!kis_assert_recoverable(const char * assertion, const char * file, int line) Line 103 (e:\krita-win\src\libs\global\kis_assert.cpp:103)
[Inline Frame] kritaimage.dll!Leapfrog<ConcurrentMap<int,KisTileData *,DefaultKeyTraits<int>,DefaultValueTraits<KisTileData *>>>::find(unsigned int) Line 161 (e:\krita-win\src\libs\image\3rdparty\lock_free_map\leapfrog.h:161)
kritaimage.dll!ConcurrentMap<int,KisTileData *,DefaultKeyTraits<int>,DefaultValueTraits<KisTileData *>>::get(int key) Line 264 (e:\krita-win\src\libs\image\3rdparty\lock_free_map\concurrent_map.h:264)
kritaimage.dll!KisTileHashTableTraits2<KisTile>::getTileLazy(int col, int row, bool & newTile) Line 314 (e:\krita-win\src\libs\image\tiles3\kis_tile_hash_table2.h:314)
kritaimage.dll!KisTiledDataManager::getTile(int col, int row, bool writable) Line 108 (e:\krita-win\src\libs\image\tiles3\kis_tiled_data_manager.h:108)
kritaimage.dll!KisTiledDataManager::getTilesPair(int col, int row, bool writable, KisSharedPtr<KisTile> * tile, KisSharedPtr<KisTile> * oldTile) Line 95 (e:\krita-win\src\libs\image\tiles3\kis_tiled_data_manager.h:95)
kritaimage.dll!KisRandomAccessor2::fetchTileData(int col, int row) Line 115 (e:\krita-win\src\libs\image\tiles3\kis_random_accessor.cc:115)
kritaimage.dll!KisRandomAccessor2::moveTo(int x, int y) Line 80 (e:\krita-win\src\libs\image\tiles3\kis_random_accessor.cc:80)
kritaimage.dll!KisPainter::bitBltImpl<0>(int dstX, int dstY, const KisSharedPtr<KisPaintDevice> srcDev, int srcX, int srcY, int srcWidth, int srcHeight) Line 797 (e:\krita-win\src\libs\image\kis_painter.cc:797)
[Inline Frame] kritaimage.dll!KisPainter::bitBlt(int) Line 828 (e:\krita-win\src\libs\image\kis_painter.cc:828)
kritaimage.dll!KisPainter::bitBlt(const QPoint & pos, const KisSharedPtr<KisPaintDevice> srcDev, const QRect & srcRect) Line 834 (e:\krita-win\src\libs\image\kis_painter.cc:834)
kritaimage.dll!copyAreaOptimizedImpl<0>(const QPoint & dstPt, KisSharedPtr<KisPaintDevice> src, KisSharedPtr<KisPaintDevice> dst, const QRect & srcRect) Line 163 (e:\krita-win\src\libs\image\kis_painter.cc:163)
kritaimage.dll!KisPainter::copyAreaOptimized(const QPoint & dstPt, KisSharedPtr<KisPaintDevice> src, KisSharedPtr<KisPaintDevice> dst, const QRect & srcRect) Line 174 (e:\krita-win\src\libs\image\kis_painter.cc:174)
kritaui.dll!KisPasteActionFactory::run(bool pasteAtCursorPosition, KisViewManager * view) Line 242 (e:\krita-win\src\libs\ui\actions\KisPasteActionFactories.cpp:242)
kritaui.dll!KisSelectionManager::paste() Line 367 (e:\krita-win\src\libs\ui\kis_selection_manager.cc:367)
Qt5Core.dll!00007ffa5a211860() (Origen desconocido:0)
Qt5Widgets.dll!00007ffa5ac276ad() (Origen desconocido:0)
Comment 4 amyspark 2021-12-01 23:01:17 UTC
Cannot reproduce anymore on cf75887435. Please let us know if it happens again on v5.