Bug 430925 - Crash When Deleting Texture
Summary: Crash When Deleting Texture
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: 4.4.1
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-29 00:28 UTC by Justice Watch
Modified: 2021-09-07 11:21 UTC (History)
5 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 Justice Watch 2020-12-29 00:28:08 UTC
SUMMARY
Krita will crash when deleting a texture.

STEPS TO REPRODUCE
1. Open Krita
2. Open Brush Editor
3. On the left sidebar, under Texture dropdown, enable Pattern
4. Click on Pattern
5. Open the Texture tab
6. Click the folder icon button and select a custom texture.
7. Select the newly created texture from within the Texture tab
8. Click on the trash icon button to delete it.

OBSERVED RESULT
Krita will crash and close shortly afterwards.
After reopening the texture menu, the texture is found to be successfully deleted.

EXPECTED RESULT
Krita should not crash.

SOFTWARE/OS VERSIONS
Windows: Windows 10 Pro Version 1909 Build 18363.1256
Qt Version: 5.12.9

ADDITIONAL INFORMATION
Bug 410499 is a similar issue.

SESSION: 28 Dec 2020 14:21:39 -0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 4.4.1, Qt version compiled: 5.12.9, loaded: 5.12.9. Process ID: 21304
-- -- -- -- -- -- -- --
28 Dec 2020 14:21:39 -0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Dec 2020 14:22:06 -0800: Importing image/vnd.adobe.photoshop to application/x-krita. Location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Real location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Batchmode: 0
28 Dec 2020 14:22:09 -0800: Loaded image from image/vnd.adobe.photoshop. Size: 3000 * 3000 pixels, 1.33333 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 25
28 Dec 2020 14:23:07 -0800: CLOSING SESSION
================================================================================
SESSION: 28 Dec 2020 14:55:15 -0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 4.4.1, Qt version compiled: 5.12.9, loaded: 5.12.9. Process ID: 24540
-- -- -- -- -- -- -- --
28 Dec 2020 14:55:15 -0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Dec 2020 14:55:23 -0800: Importing image/vnd.adobe.photoshop to application/x-krita. Location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Real location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Batchmode: 0
28 Dec 2020 14:55:26 -0800: Loaded image from image/vnd.adobe.photoshop. Size: 3000 * 3000 pixels, 1.33333 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 25
================================================================================
SESSION: 28 Dec 2020 14:58:30 -0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 4.4.1, Qt version compiled: 5.12.9, loaded: 5.12.9. Process ID: 15396
-- -- -- -- -- -- -- --
28 Dec 2020 14:58:30 -0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Dec 2020 14:58:42 -0800: Importing image/vnd.adobe.photoshop to application/x-krita. Location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Real location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Batchmode: 0
28 Dec 2020 14:58:45 -0800: Loaded image from image/vnd.adobe.photoshop. Size: 3000 * 3000 pixels, 1.33333 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 25
================================================================================
SESSION: 28 Dec 2020 15:00:20 -0800. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 4.4.1, Qt version compiled: 5.12.9, loaded: 5.12.9. Process ID: 21900
-- -- -- -- -- -- -- --
28 Dec 2020 15:00:20 -0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
28 Dec 2020 15:00:27 -0800: Importing image/vnd.adobe.photoshop to application/x-krita. Location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Real location: C:/Users/xions/OneDrive/Saved Pictures/Kritaculous/endnesia.psd. Batchmode: 0
28 Dec 2020 15:00:30 -0800: Loaded image from image/vnd.adobe.photoshop. Size: 3000 * 3000 pixels, 1.33333 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 25
Comment 1 Justice Watch 2020-12-29 00:36:34 UTC
Video demonstration

https://drive.google.com/file/d/1_FG6AloxL8ZNrPxbdq-R5_tPMYM9FiX0/view?usp=sharing
Comment 2 Tom Wu 2021-01-01 01:48:44 UTC
I was able to duplicate this bug... The crash occurs before a log is created. Below are some details found during debugging:

A segfault occurs inside the call to setCurrentItem() within KoResourceItemChooser during texture removal. The row/col indices being passed in appear to be valid. The segfault generally happens on a different thread, so the issue could be concurrency-related.
Commenting out that line (239) avoids crashing Krita but leaves nothing selected after deleting a texture. Just wanted to document these findings in case it helps a dev address the root cause.
Comment 3 Antti Savolainen 2021-01-23 07:17:54 UTC
I am able to reproduce this on Linux and on 4.4.2. Does not need to be a newly created texture.
Demonstrative video: https://youtu.be/6BM5zsXuIwU

Goddamn desktop froze when trying to get a backtrace out of this
Backtrace:
Thread 30 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffa1ffb640 (LWP 3589)]
0x00007ffff38fe38d in QByteArray::isEmpty (this=<optimized out>) at /usr/include/qt/QtCore/qbytearray.h:507
507	{ return d->size == 0; }
#0  0x00007ffff38fe38d in QByteArray::isEmpty (this=<optimized out>) at /usr/include/qt/QtCore/qbytearray.h:507
#1  KoResource::md5 (this=0x55555e97ea80) at /usr/src/debug/krita-4.4.2/libs/pigment/resources/KoResource.cpp:80
#2  0x00007fffdeb689b5 in operator== (lhs=..., rhs=...) at /usr/src/debug/krita-4.4.2/plugins/paintops/libpaintop/KisTextureMaskInfo.cpp:70
#3  0x00007fffdeb69a6e in boost::operators_impl::operator!= (y=..., x=...) at /usr/include/boost/operators.hpp:169
#4  KisTextureMaskInfoCache::fetchCachedTextureInfo (this=0x7fffdebaa460 <(anonymous namespace)::Q_QGS_s_instance::innerFunction()::holder>, info=...) at /usr/src/debug/krita-4.4.2/plugins/paintops/libpaintop/KisTextureMaskInfo.cpp:270
#5  0x00007fffdeb66301 in KisTextureProperties::fillProperties (this=this@entry=0x7fff8c01bd80, setting=...) at /usr/src/debug/krita-4.4.2/plugins/paintops/libpaintop/kis_texture_option.cpp:232
#6  0x00007fffdeb2821b in KisBrushBasedPaintOp::KisBrushBasedPaintOp (this=0x7fff8c01bd50, settings=..., painter=<optimized out>) at /usr/src/debug/krita-4.4.2/plugins/paintops/libpaintop/kis_brush_based_paintop.cpp:106
#7  0x00007fffdea90eaa in KisBrushOp::KisBrushOp (this=0x7fff8c01bd50, settings=..., painter=0x555564c41db0, node=..., image=...) at /usr/src/debug/krita-4.4.2/plugins/paintops/defaultpaintops/brush/kis_brushop.cpp:67
#8  0x00007fffdea8f933 in KisSimplePaintOpFactory<KisBrushOp, KisBrushOpSettings, KisBrushOpSettingsWidget>::createOp (this=<optimized out>, settings=..., painter=0x555564c41db0, node=..., image=...)
    at /usr/src/debug/krita-4.4.2/plugins/paintops/libpaintop/kis_simple_paintop_factory.h:85
#9  0x00007ffff5eff927 in KisPaintOpRegistry::paintOp (this=0x7fffa1ffa828, id=..., settings=..., painter=0x555564c41db0, node=..., image=...) at /usr/src/debug/krita-4.4.2/libs/image/brushengine/kis_paintop_registry.cc:104
#10 0x00007ffff5effdfd in KisPaintOpRegistry::paintOp (this=0x7ffff61e56e0 <(anonymous namespace)::Q_QGS_s_registryInstance::innerFunction()::holder>, preset=..., painter=0x555564c41db0, node=..., image=...)
    at /usr/src/debug/krita-4.4.2/libs/image/brushengine/kis_paintop_registry.cc:120
#11 0x00007ffff5ee0a25 in KisPainter::setPaintOpPreset (this=this@entry=0x555564c41db0, preset=..., node=..., image=...) at /usr/src/debug/krita-4.4.2/libs/image/kis_painter.cc:2743
#12 0x00007ffff6f898d3 in KisResourcesSnapshot::setupPainter (this=0x555564abdcc0, painter=painter@entry=0x555564c41db0) at /usr/src/debug/krita-4.4.2/libs/ui/tool/kis_resources_snapshot.cpp:201
#13 0x00007ffff6f90e25 in KisPainterBasedStrokeStrategy::initPainters (this=0x5555651e51c0, targetDevice=..., maskingDevice=..., selection=..., hasIndirectPainting=true, indirectPaintingCompositeOp=...)
    at /usr/src/debug/krita-4.4.2/libs/global/kis_shared_ptr.h:179
#14 0x00007ffff6f91644 in KisPainterBasedStrokeStrategy::initStrokeCallback (this=this@entry=0x5555651e51c0) at /usr/src/debug/krita-4.4.2/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp:286
#15 0x00007ffff6f8eeaa in FreehandStrokeStrategy::initStrokeCallback (this=0x5555651e51c0) at /usr/src/debug/krita-4.4.2/libs/ui/tool/strokes/freehand_stroke.cpp:135
#16 0x00007ffff5eb5708 in KisStrokeJob::run (this=<optimized out>) at /usr/src/debug/build/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../krita-4.4.2/libs/image/kis_stroke_job.h:44
#17 KisUpdateJobItem::run (this=0x555561a98960) at /usr/src/debug/build/libs/image/kritaimage_autogen/EWIEGA46WW/../../../../../krita-4.4.2/libs/image/kis_update_job_item.h:102
#18 0x00007ffff492f302 in ?? () from /usr/lib/libQt5Core.so.5
#19 0x00007ffff492bf0f in ?? () from /usr/lib/libQt5Core.so.5
#20 0x00007ffff29013e9 in start_thread () from /usr/lib/libpthread.so.0
#21 0x00007ffff459e293 in clone () from /usr/lib/libc.so.6
Comment 4 Halla Rempt 2021-01-23 12:21:12 UTC
The desktop will likely have frozen because the crash happened when a popup was showing; ordinarily the app then closes, but when running in gdb, it will stay open for investigation. But X11 is weird when it comes to popup windows, it won't allow clicks anywhere else.
Comment 5 Tiar 2021-08-19 18:13:38 UTC
Does it happen in Krita 5.0-beta1?
Comment 6 Halla Rempt 2021-09-07 11:21:49 UTC
No, it's fixed in 5.0