Bug 454198 - Krita Layer Docker.dll crash
Summary: Krita Layer Docker.dll crash
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Dockers (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Compiled Sources All
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-22 07:54 UTC by spinear
Modified: 2022-05-23 08:49 UTC (History)
2 users (show)

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


Attachments
crash log (23.91 KB, text/plain)
2022-05-22 07:54 UTC, spinear
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spinear 2022-05-22 07:54:25 UTC
Created attachment 149101 [details]
crash log

Krita
  Version: 5.1.0-prealpha (git c356cf8)

STEPS TO REPRODUCE
Sorry, there are no steps to reproduce but I got an idea of where it is.

I use kinetic scroll -> on click.
So I do the middle or right button to move layers.

The crash happens when you move, click, or hide layers inside the group but not always. it's pretty rare.

I got 70+layers, the project uses 2.3 GiB memory, project file size is 140MB.

I'm sorry for can't give you more information.

Krita
  Version: 5.1.0-prealpha (git c356cf8)

Qt
  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information
  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19043
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10


OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0)" 
  Version:  "OpenGL ES 3.0 (ANGLE 2.1.0.57ea533f79a7)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0.57ea533f79a7)" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions false 
     is OpenGL ES: true 
  supportsBufferMapping: true 
  supportsBufferInvalidation: false 
  Extensions: 
     "GL_OES_texture_npot" 
     "GL_EXT_color_buffer_float" 
     "GL_EXT_debug_marker" 
     "GL_OES_texture_half_float_linear" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_CHROMIUM_sync_query" 
     "GL_OES_mapbuffer" 
     "GL_ANGLE_translated_shader_source" 
     "GL_ANGLE_instanced_arrays" 
     "GL_EXT_color_buffer_half_float" 
     "GL_ANGLE_lossy_etc_decode" 
     "GL_ANGLE_depth_texture" 
     "GL_OES_packed_depth_stencil" 
     "GL_EXT_texture_norm16" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_EXT_draw_buffers" 
     "GL_ANGLE_request_extension" 
     "GL_EXT_read_format_bgra" 
     "GL_OES_depth32" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_EXT_texture_rg" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_CHROMIUM_color_buffer_float_rgb" 
     "GL_EXT_disjoint_timer_query" 
     "GL_OES_EGL_image_external" 
     "GL_OES_EGL_image" 
     "GL_OES_standard_derivatives" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_OES_texture_float" 
     "GL_EXT_frag_depth" 
     "GL_EXT_map_buffer_range" 
     "GL_OES_get_program_binary" 
     "GL_OES_vertex_array_object" 
     "GL_CHROMIUM_color_buffer_float_rgba" 
     "GL_EXT_shader_texture_lod" 
     "GL_EXT_texture_storage" 
     "GL_EXT_robustness" 
     "GL_OES_element_index_uint" 
     "GL_CHROMIUM_copy_texture" 
     "GL_OES_rgb8_rgba8" 
     "GL_OES_surfaceless_context" 
     "GL_EXT_discard_framebuffer" 
     "GL_NV_pack_subimage" 
     "GL_OES_texture_float_linear" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_EXT_texture_filter_anisotropic" 
     "GL_EXT_unpack_subimage" 
     "GL_ANGLE_multiview" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_EXT_sRGB" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_ANGLE_texture_usage" 
     "GL_KHR_debug" 
     "GL_ANGLE_program_cache_control" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_EXT_blend_minmax" 
     "GL_NV_fence" 
     "GL_OES_texture_half_float" 
     "" 
     "GL_OES_compressed_ETC1_RGB8_texture" 
     "GL_NV_pixel_buffer_object" 
     "GL_ANGLE_client_arrays" 
     "GL_ANGLE_robust_client_memory" 
     "GL_ANGLE_framebuffer_multisample" 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsAngleD3D11: true 
  isQtPreferAngle: true 

Hardware Information
 Memory: 31 Gb
 Cores: 8
 Swap: C:/Users/USER/AppData/Local/Temp
Comment 1 Lynx3d 2022-05-22 08:44:33 UTC
I got a segfault with git c7800eb3 too, but so far clueless what the cause is:

Thread 1 (Thread 0x7f6486242d80 (LWP 90210)):
[KCrash Handler]
#6  QString::QString(QString const&) (other=..., this=0x7ffd548b5748) at /opt/qt515-kde/include/QtCore/qstring.h:1093
#7  KisBaseNode::Property::Property(KisBaseNode::Property const&) (this=0x7ffd548b5748) at (...)/libs/image/kis_base_node.h:51
#8  boost::optional_detail::optional_base<KisBaseNode::Property>::construct(KisBaseNode::Property const&) (val=..., this=0x7ffd548b5740) at /usr/include/boost/optional/optional.hpp:402
#9  boost::optional_detail::optional_base<KisBaseNode::Property>::optional_base(boost::optional_detail::init_value_tag, KisBaseNode::Property const&) (val=..., this=0x7ffd548b5740) at /usr/include/boost/optional/optional.hpp:156
#10 boost::optional<KisBaseNode::Property>::optional(KisBaseNode::Property const&) (val=..., this=0x7ffd548b5740) at /usr/include/boost/optional/optional.hpp:875
#11 NodeDelegate::Private::propForMousePos(QModelIndex const&, QPoint const&, QStyleOptionViewItem const&) (this=<optimized out>, index=..., mousePos=..., option=...) at (...)/plugins/dockers/layerdocker/NodeDelegate.cpp:908
#12 0x00007f647428ef71 in NodeDelegate::editorEvent(QEvent*, QAbstractItemModel*, QStyleOptionViewItem const&, QModelIndex const&) (this=this@entry=0x562420b0ec90, event=event@entry=0x7ffd548b5ca0, model=0x562420b3c940, option=..., index=...) at /opt/qt515-kde/include/QtGui/qevent.h:730
#13 0x00007f64742960f7 in NodeView::viewportEvent(QEvent*) (this=0x562420afafb0, e=0x7ffd548b5ca0) at (...)/plugins/dockers/layerdocker/NodeView.cpp:290
#14 0x00007f648b85a8b3 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Core.so.5
#15 0x00007f648c399db2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Widgets.so.5
#16 0x00007f648c3a319f in QApplication::notify(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Widgets.so.5
#17 0x00007f648dbe534e in KisApplication::notify(QObject*, QEvent*) (this=0x7ffd548b6500, receiver=0x562420b0a980, event=0x7ffd548b5ca0) at (...)/libs/ui/KisApplication.cpp:758
#18 0x00007f648b85ab4a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Core.so.5
#19 0x00007f648c3a1439 in QApplication::event(QEvent*) () at /opt/qt515-kde/lib/libQt5Widgets.so.5
#20 0x00007f648c399dc3 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Widgets.so.5
#21 0x00007f648c3a2bb8 in QApplication::notify(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Widgets.so.5
#22 0x00007f648dbe534e in KisApplication::notify(QObject*, QEvent*) (this=0x7ffd548b6500, receiver=0x7ffd548b6500, event=0x7ffd548b6010) at (...)/libs/ui/KisApplication.cpp:758
#23 0x00007f648b85ab4a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /opt/qt515-kde/lib/libQt5Core.so.5
#24 0x00007f648b8b46f0 in QTimerInfoList::activateTimers() () at /opt/qt515-kde/lib/libQt5Core.so.5
#25 0x00007f648b8b5024 in  () at /opt/qt515-kde/lib/libQt5Core.so.5
#26 0x00007f6488df617d in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007f6488df6400 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f6488df64a3 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f648b8b53a2 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /opt/qt515-kde/lib/libQt5Core.so.5
#30 0x00007f648b85964b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /opt/qt515-kde/lib/libQt5Core.so.5
#31 0x00007f648b861804 in QCoreApplication::exec() () at /opt/qt515-kde/lib/libQt5Core.so.5
#32 0x00005624129f9923 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at (...)/krita/main.cc:717
[Inferior 1 (process 90210) detached]
Comment 2 Lynx3d 2022-05-22 19:14:24 UTC
Uh okay this crash sure is hard to reproduce here, I was lucky the first one happened within seconds, took me hours to get another one.

Unfortunately, none of my asserts triggered, but reading through the code, something sure looks odd to me. Access to `KisBaseNode::Private::properties` doesn't seem to be protected at all from concurrent access, but they are manipulated by the strokes system from what I understand, which means it IS concurrent to the UI thread.

If that's correct, it's only a matter of time until things go wrong, and kinetic scrolling which constantly paints the layers docker just greatly increases the likeliness that this happens.
Comment 3 Dmitry Kazakov 2022-05-23 07:29:43 UTC
Hi, Linxd!

The most probably cause of this backtrace is that `QList<OptionalProperty> realProps` contains some null pointers and this pointer is dereferenced while constructing a boost::optional object. `OptionalProperty` is just a pointer, which is a historical artifact. And `propForMousePos` just tried to glue legacy optional properties to the modern ones.
Comment 4 Lynx3d 2022-05-23 08:49:51 UTC
Git commit b6dba3fdfab363abb20d92bb142105ff58f87feb by Mathias Wein.
Committed on 23/05/2022 at 08:46.
Pushed by mwein into branch 'master'.

Fix crash in NodeDelegate

Some node types don't feature all properties, but to keep alignment,
the list contains nullptr entries.

M  +1    -0    plugins/dockers/layerdocker/NodeDelegate.cpp

https://invent.kde.org/graphics/krita/commit/b6dba3fdfab363abb20d92bb142105ff58f87feb