Bug 458857

Summary: Using Select All or CTRL+A to select the background layer and attempting to Copy or Paste it results in Krita freezing and needing to be killed
Product: [Applications] krita Reporter: sockmonkeymonk
Component: Tools/SelectionAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: crash CC: amy, halla, mangatengu
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: DxDiag.txt
KritaSubmitBugReportWindowText.txt
Kritacrash-Small.mp4

Description sockmonkeymonk 2022-09-08 04:28:28 UTC
SUMMARY
On a fresh installation of Windows 11 Pro, using Krita 5.1.0 64-bit downloaded and installed using the installer from the website.
Attempting to Cut or Copy the starting layer (background) of a canvas causes the program to freeze up and requires you to kill the process.

STEPS TO REPRODUCE
1. Open Krita
2. Create a new Canvas (From Clipboard or Blank)
3. Use CTRL+A or Select->Select All from the menu to select the "Background" layer in its entirety
4. Use CTRL+C or CTRL+X or Edit->Cut or Edit->Copy
5. The program will stop responding indefinitely
6. Kill the program via task manager or clicking on it rapidly to bring up the prompt asking if you want to kill the program

OBSERVED RESULT
Krita locks up and becomes unresponsive
When trying to paste into MS Paint it pops up the warning "The information on the Clipboard can't be inserted into Paint."
The information on the clipboard also cannot be pasted into a text editor. Windows+V to bring up the clipboard shows no entry.

EXPECTED RESULT
The background layer is copied or cut and can be pasted inside or outside of Krita

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0
 Installation type: installer / portable package
 Hidpi: true

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.22000
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

Locale

  Languages: en_US
  C locale: C
  QLocale current: en
  QLocale system: en
  QTextCodec for locale: UTF-8
  Process ACP: 65001 (UTF-8)
  System locale default ACP: 1252  (ANSI - Latin I)

OpenGL Info
 
  Vendor:  "Google Inc. (NVIDIA)" 
  Renderer:  "ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Ti Direct3D11 vs_5_0 ps_5_0, D3D11-31.0.15.1694)" 
  Version:  "OpenGL ES 3.0.0 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  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 
  forceDisableTextureBuffers: true 
  Extensions: 
     "GL_EXT_color_buffer_float" 
     "GL_CHROMIUM_copy_texture" 
     "GL_OES_compressed_ETC2_punchthroughA_RGBA8_texture" 
     "GL_OES_get_program_binary" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_EXT_debug_label" 
     "GL_OES_texture_half_float" 
     "GL_ANGLE_texture_usage" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_NV_pack_subimage" 
     "GL_ANGLE_provoking_vertex" 
     "GL_EXT_map_buffer_range" 
     "GL_OES_compressed_EAC_R11_signed_texture" 
     "GL_ANGLE_request_extension" 
     "GL_EXT_texture_storage" 
     "GL_EXT_texture_rg" 
     "GL_OES_texture_npot" 
     "GL_EXT_texture_norm16" 
     "GL_EXT_disjoint_timer_query" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_ANGLE_base_vertex_base_instance_shader_builtin" 
     "GL_EXT_multisampled_render_to_texture" 
     "GL_OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture" 
     "GL_OES_element_index_uint" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_EXT_texture_compression_bptc" 
     "GL_EXT_texture_filter_anisotropic" 
     "GL_ANGLE_multi_draw" 
     "GL_ANGLE_base_vertex_base_instance" 
     "GL_NV_fence" 
     "GL_OES_compressed_ETC2_sRGB8_texture" 
     "GL_ANGLE_copy_texture_3d" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_EXT_frag_depth" 
     "GL_OES_compressed_EAC_RG11_unsigned_texture" 
     "GL_OES_EGL_image_external" 
     "GL_EXT_texture_type_2_10_10_10_REV" 
     "GL_OES_texture_half_float_linear" 
     "GL_ANGLE_robust_client_memory" 
     "GL_EXT_shader_texture_lod" 
     "GL_EXT_unpack_subimage" 
     "GL_EXT_blend_minmax" 
     "GL_OES_texture_border_clamp" 
     "GL_OES_vertex_array_object" 
     "GL_EXT_draw_elements_base_vertex" 
     "GL_OVR_multiview" 
     "GL_OVR_multiview2" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_EXT_read_format_bgra" 
     "GL_ANGLE_instanced_arrays" 
     "GL_OES_draw_elements_base_vertex" 
     "GL_ANGLE_get_tex_level_parameter" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_EXT_color_buffer_half_float" 
     "GL_OES_fbo_render_mipmap" 
     "GL_EXT_instanced_arrays" 
     "GL_OES_texture_float" 
     "GL_KHR_parallel_shader_compile" 
     "GL_OES_texture_float_linear" 
     "GL_EXT_debug_marker" 
     "GL_EXT_draw_buffers" 
     "GL_OES_compressed_ETC2_sRGB8_alpha8_texture" 
     "GL_OES_depth24" 
     "GL_EXT_discard_framebuffer" 
     "GL_EXT_float_blend" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_EXT_clip_control" 
     "GL_OES_standard_derivatives" 
     "GL_ANGLE_client_arrays" 
     "GL_OES_compressed_ETC2_RGB8_texture" 
     "GL_OES_draw_buffers_indexed" 
     "GL_ANGLE_multiview_multisample" 
     "GL_CHROMIUM_sync_query" 
     "GL_EXT_robustness" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_OES_packed_depth_stencil" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_OES_compressed_EAC_R11_unsigned_texture" 
     "GL_ANGLE_translated_shader_source" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_CHROMIUM_lose_context" 
     "GL_ANGLE_get_serialized_context_string" 
     "GL_ANGLE_program_cache_control" 
     "GL_KHR_debug" 
     "GL_NV_pixel_buffer_object" 
     "GL_ANGLE_lossy_etc_decode" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_ANGLE_texture_multisample" 
     "GL_EXT_draw_buffers_indexed" 
     "GL_ANGLE_depth_texture" 
     "GL_ANGLE_framebuffer_multisample" 
     "GL_OES_EGL_image" 
     "GL_EXT_blend_func_extended" 
     "GL_OES_rgb8_rgba8" 
     "GL_WEBGL_video_texture" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_OES_compressed_EAC_RG11_signed_texture" 
     "GL_ANGLE_memory_size" 
     "GL_EXT_EGL_image_external_wrap_modes" 
     "GL_EXT_texture_compression_rgtc" 
     "GL_OES_surfaceless_context" 
     "GL_AMD_performance_monitor" 
     "GL_OES_mapbuffer" 
     "GL_NV_framebuffer_blit" 
     "GL_OES_texture_stencil8" 
     "" 
     "GL_EXT_multi_draw_indirect" 
     "GL_OES_depth32" 
     "GL_EXT_sRGB" 
     "GL_OES_compressed_ETC2_RGBA8_texture" 

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

useBufferInvalidation (config option): false


ADDITIONAL INFORMATION
You can select smaller portions or select larger than the canvas size and it will not crash when using Cut or Paste on the Background layer. You can also create new layers and use Select All + Copy/Cut without causing a crash.

Not sure why it shows Windows 10 as my OS unless it doesn't detect Windows 11 info yet.

Attached a DxDiag output, Submit Bug Request text output, a recording demonstrating the crash twice, and a recording demonstrating the info Krita displays (saying Windows 10 for some reason) + crashing from displaying that
Comment 1 sockmonkeymonk 2022-09-08 04:29:27 UTC
Created attachment 151912 [details]
DxDiag.txt

Output from DxDiag about PC specs
Comment 2 sockmonkeymonk 2022-09-08 04:30:02 UTC
Created attachment 151913 [details]
KritaSubmitBugReportWindowText.txt

The content from Krita's Submit Bug Report Window
Comment 3 sockmonkeymonk 2022-09-08 04:37:11 UTC
Created attachment 151914 [details]
Kritacrash-Small.mp4

Scaled down video
Comment 4 sockmonkeymonk 2022-09-08 04:40:17 UTC
Crash demonstration video added to Youtube Unlisted - https://youtu.be/sVH-CFTWMmQ
Comment 5 Halla Rempt 2022-09-12 09:38:00 UTC
That's also a crazy slow startup time. The contents of the bug info dialog aren't complete, though, information from the bottom is missing, and that is weird in itself.
Comment 6 Dmitry Kazakov 2022-09-16 11:08:17 UTC
Git commit aac9375843b3018564cea285b91f82c7f3b9fda2 by Dmitry Kazakov.
Committed on 16/09/2022 at 11:07.
Pushed by dkazakov into branch 'master'.

Fix a crash when trying to copy-paste the background layer

Such layers usually have non-transparent default pixel, which
automatically needs an image for exact bounds calculation, which
doesn't exist for the detached layers.

The patch saves the copied area bounds on the construction
of mime data, much before the layers become detached.
Related: bug 458890, bug 458248, bug 458941

M  +12   -11   libs/ui/kis_mimedata.cpp
M  +2    -0    libs/ui/kis_mimedata.h

https://invent.kde.org/graphics/krita/commit/aac9375843b3018564cea285b91f82c7f3b9fda2
Comment 7 Dmitry Kazakov 2022-09-16 11:09:16 UTC
Git commit 1d9698635a0f8289263bcb057727bf69cb48e8fa by Dmitry Kazakov.
Committed on 16/09/2022 at 11:09.
Pushed by dkazakov into branch 'krita/5.1'.

Fix a crash when trying to copy-paste the background layer

Such layers usually have non-transparent default pixel, which
automatically needs an image for exact bounds calculation, which
doesn't exist for the detached layers.

The patch saves the copied area bounds on the construction
of mime data, much before the layers become detached.
Related: bug 458890, bug 458248, bug 458941


(cherry picked from commit aac9375843b3018564cea285b91f82c7f3b9fda2)

M  +12   -11   libs/ui/kis_mimedata.cpp
M  +2    -0    libs/ui/kis_mimedata.h

https://invent.kde.org/graphics/krita/commit/1d9698635a0f8289263bcb057727bf69cb48e8fa
Comment 8 sockmonkeymonk 2022-09-16 20:28:06 UTC
Did this fix get included in 5.1.1?

I ran the installer to upgrade to 5.1.1 and can still crash the program using Select All and a Cut/Copy
I also tried uninstalling Krita and installing it fresh and run into the same issue

On the plus side, it opens much much quicker now

New paste from "Submit Bug Report" window:

Krita

 Version: 5.1.1
 Installation type: installer / portable package
 Hidpi: true

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.22000
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

Locale

  Languages: en_US
  C locale: C
  QLocale current: en
  QLocale system: en
  QTextCodec for locale: UTF-8
  Process ACP: 65001 (UTF-8)
  System locale default ACP: 1252  (ANSI - Latin I)

OpenGL Info
 
  Vendor:  "Google Inc. (NVIDIA)" 
  Renderer:  "ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Ti Direct3D11 vs_5_0 ps_5_0, D3D11-31.0.15.1694)" 
  Version:  "OpenGL ES 3.0.0 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  Shading language:  "OpenGL ES GLSL ES 3.00 (ANGLE 2.1.0 git hash: f2280c0c5f93+krita_qt5.12.12)" 
  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 
  forceDisableTextureBuffers: true 
  Extensions: 
     "GL_EXT_multisampled_render_to_texture" 
     "GL_OES_compressed_EAC_R11_signed_texture" 
     "GL_AMD_performance_monitor" 
     "GL_EXT_debug_label" 
     "GL_EXT_draw_buffers_indexed" 
     "GL_OES_texture_half_float" 
     "GL_EXT_texture_type_2_10_10_10_REV" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_KHR_parallel_shader_compile" 
     "GL_EXT_disjoint_timer_query" 
     "GL_EXT_draw_buffers" 
     "GL_OES_texture_stencil8" 
     "GL_OES_EGL_image_external" 
     "GL_OES_compressed_ETC2_punchthroughA_RGBA8_texture" 
     "GL_OES_texture_float_linear" 
     "GL_NV_pack_subimage" 
     "GL_KHR_debug" 
     "GL_EXT_color_buffer_half_float" 
     "GL_EXT_frag_depth" 
     "GL_ANGLE_multi_draw" 
     "GL_CHROMIUM_lose_context" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_OES_texture_border_clamp" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture" 
     "GL_OES_compressed_ETC2_sRGB8_alpha8_texture" 
     "GL_OES_draw_elements_base_vertex" 
     "GL_OES_texture_half_float_linear" 
     "GL_OES_depth24" 
     "GL_EXT_texture_storage" 
     "GL_EXT_EGL_image_external_wrap_modes" 
     "GL_OES_compressed_ETC2_RGB8_texture" 
     "GL_OES_compressed_EAC_RG11_unsigned_texture" 
     "GL_OES_texture_npot" 
     "GL_ANGLE_framebuffer_multisample" 
     "GL_ANGLE_client_arrays" 
     "GL_EXT_clip_control" 
     "GL_EXT_sRGB" 
     "GL_OES_compressed_ETC2_sRGB8_texture" 
     "GL_ANGLE_texture_multisample" 
     "GL_ANGLE_provoking_vertex" 
     "GL_OES_compressed_EAC_RG11_signed_texture" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_OES_standard_derivatives" 
     "GL_OES_compressed_EAC_R11_unsigned_texture" 
     "" 
     "GL_ANGLE_texture_usage" 
     "GL_EXT_draw_elements_base_vertex" 
     "GL_EXT_map_buffer_range" 
     "GL_OES_draw_buffers_indexed" 
     "GL_ANGLE_program_cache_control" 
     "GL_EXT_unpack_subimage" 
     "GL_WEBGL_video_texture" 
     "GL_OES_fbo_render_mipmap" 
     "GL_OES_texture_float" 
     "GL_OES_compressed_ETC2_RGBA8_texture" 
     "GL_ANGLE_depth_texture" 
     "GL_OES_mapbuffer" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_OES_surfaceless_context" 
     "GL_EXT_multi_draw_indirect" 
     "GL_EXT_color_buffer_float" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_EXT_debug_marker" 
     "GL_OES_rgb8_rgba8" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_ANGLE_base_vertex_base_instance_shader_builtin" 
     "GL_OES_vertex_array_object" 
     "GL_OVR_multiview2" 
     "GL_NV_pixel_buffer_object" 
     "GL_EXT_robustness" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_ANGLE_get_serialized_context_string" 
     "GL_EXT_read_format_bgra" 
     "GL_EXT_texture_filter_anisotropic" 
     "GL_EXT_shader_texture_lod" 
     "GL_EXT_texture_compression_bptc" 
     "GL_ANGLE_get_tex_level_parameter" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_OES_get_program_binary" 
     "GL_NV_framebuffer_blit" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_EXT_discard_framebuffer" 
     "GL_EXT_texture_rg" 
     "GL_ANGLE_base_vertex_base_instance" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_EXT_instanced_arrays" 
     "GL_OES_packed_depth_stencil" 
     "GL_OES_element_index_uint" 
     "GL_ANGLE_instanced_arrays" 
     "GL_OVR_multiview" 
     "GL_ANGLE_multiview_multisample" 
     "GL_EXT_float_blend" 
     "GL_EXT_blend_minmax" 
     "GL_EXT_blend_func_extended" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_EXT_texture_norm16" 
     "GL_OES_depth32" 
     "GL_ANGLE_lossy_etc_decode" 
     "GL_ANGLE_robust_client_memory" 
     "GL_NV_fence" 
     "GL_EXT_texture_compression_rgtc" 
     "GL_ANGLE_copy_texture_3d" 
     "GL_CHROMIUM_sync_query" 
     "GL_ANGLE_request_extension" 
     "GL_CHROMIUM_copy_texture" 
     "GL_OES_EGL_image" 
     "GL_ANGLE_memory_size" 
     "GL_ANGLE_translated_shader_source" 

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

useBufferInvalidation (config option): false


Hardware Information

  GPU Acceleration: auto
  Memory: 65480 Mb
  Number of Cores: 24
  Swap Location: C:/Users/Sock/AppData/Local/Temp
  Built for: sse2
  Base instruction set: sse2
  Supported instruction sets: fma3+avx2 avx2 fma3+avx avx fma4 fma3+sse4.2 sse4.2 sse4.1 ssse3 sse3 sse2 

Current Settings

  Current Swap Location: C:/Users/Sock/AppData/Local/Temp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 200
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Disable Vector Optimizations: false
  Disable AVX Optimizations: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 420
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: false
  Use Zip64: false


Display Information
Number of screens: 3
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Physical DPI108.888
		Logical DPI96
		Physical Size: 597, 336
		Position: 0, 0
		Resolution in pixels: 2560x1440
		Manufacturer: 
		Model: 
		Refresh Rate: 59
	Screen: 1
		Name: \\.\DISPLAY2
		Depth: 32
		Scale: 1
		Physical DPI81.5973
		Logical DPI96
		Physical Size: 598, 336
		Position: -1920, 0
		Resolution in pixels: 1920x1080
		Manufacturer: 
		Model: 
		Refresh Rate: 60
	Screen: 2
		Name: \\.\DISPLAY3
		Depth: 32
		Scale: 1
		Physical DPI102.598
		Logical DPI96
		Physical Size: 476, 267
		Position: 380, 1440
		Resolution in pixels: 1920x1080
		Manufacturer: 
		Model: 
		Refresh Rate: 60


---------------------
================================================================================
SESSION: 16 Sep 2022 16:24:49 -0400. Executing C:\Program Files\Krita (x64)\bin\krita.exe

Krita Version: 5.1.1, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 67052
-- -- -- -- -- -- -- --
16 Sep 2022 16:24:49 -0400: Style: fusion. Available styles: windowsvista, Windows, Fusion
16 Sep 2022 16:24:51 -0400: Database is up to date. Version: 0.0.17, created by Krita 5.1.0, at Wed Sep 7 01:36:43 2022
16 Sep 2022 16:24:51 -0400: Non-store package - creating updater

---------------------
Comment 9 amyspark 2022-09-26 16:45:39 UTC
*** Bug 459459 has been marked as a duplicate of this bug. ***