Bug 447417

Summary: After opening the svg, krita unresponsive, and the ram usage keeps increasing.
Product: [Applications] krita Reporter: Eranthis stellata Maxim <1012468643>
Component: File formatsAssignee: sh_zam <shzam>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, griffinvalley, shzam
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Attachments: The svg file that triggered the bug.
Imported the twitter icon .svg file
Opened Twitter Bird Icon
The bird .svg path opened as a path in GIMP

Description Eranthis stellata Maxim 2021-12-23 10:34:20 UTC
Created attachment 144801 [details]
The svg file that triggered the bug.

SUMMARY

After opening the svg, krita unresponsive, and the ram usage keeps increasing. 

STEPS TO REPRODUCE
1. Open the svg file. 
2. Press Enter to confirm the default ppi. 
Krita is unresponsive and ram usage keeps increasing. 

OBSERVED RESULT
Krita is unresponsive and ram usage keeps increasing. 

EXPECTED RESULT
Open the svg file correctly. 

SOFTWARE/OS VERSIONS
Krita

 Version: 5.0.0
 Languages: zh_CN, zh, en_US, en, zh_CN, zh, en_US, en, zh_CN, zh, en_US, en, zh_CN, zh, en_US, en, zh_CN, zh, en_US, en
 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.19042
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

OpenGL Info
 
  Vendor:  "Google Inc." 
  Renderer:  "ANGLE (NVIDIA GeForce GTX 970 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_EXT_discard_framebuffer" 
     "GL_CHROMIUM_sync_query" 
     "GL_EXT_shader_texture_lod" 
     "GL_OES_texture_half_float" 
     "GL_OES_vertex_array_object" 
     "GL_NV_fence" 
     "GL_EXT_disjoint_timer_query" 
     "GL_EXT_blend_minmax" 
     "GL_EXT_robustness" 
     "GL_ANGLE_translated_shader_source" 
     "GL_OES_texture_float" 
     "GL_EXT_sRGB" 
     "GL_OES_texture_float_linear" 
     "GL_EXT_frag_depth" 
     "GL_OES_element_index_uint" 
     "GL_EXT_texture_rg" 
     "GL_OES_depth32" 
     "GL_EXT_color_buffer_half_float" 
     "GL_OES_EGL_image_external" 
     "GL_ANGLE_robust_client_memory" 
     "GL_ANGLE_texture_compression_dxt5" 
     "GL_NV_EGL_stream_consumer_external" 
     "GL_CHROMIUM_color_buffer_float_rgb" 
     "GL_EXT_texture_format_BGRA8888" 
     "GL_OES_EGL_image" 
     "GL_ANGLE_texture_usage" 
     "GL_EXT_read_format_bgra" 
     "GL_ANGLE_framebuffer_blit" 
     "GL_ANGLE_framebuffer_multisample" 
     "GL_OES_EGL_image_external_essl3" 
     "GL_OES_compressed_ETC1_RGB8_texture" 
     "GL_EXT_occlusion_query_boolean" 
     "GL_ANGLE_program_cache_control" 
     "GL_EXT_texture_compression_s3tc_srgb" 
     "GL_EXT_unpack_subimage" 
     "GL_NV_pack_subimage" 
     "" 
     "GL_ANGLE_request_extension" 
     "GL_ANGLE_instanced_arrays" 
     "GL_CHROMIUM_bind_uniform_location" 
     "GL_NV_pixel_buffer_object" 
     "GL_EXT_map_buffer_range" 
     "GL_OES_rgb8_rgba8" 
     "GL_ANGLE_pack_reverse_row_order" 
     "GL_CHROMIUM_copy_texture" 
     "GL_CHROMIUM_bind_generates_resource" 
     "GL_KHR_debug" 
     "GL_OES_texture_npot" 
     "GL_EXT_draw_buffers" 
     "GL_ANGLE_depth_texture" 
     "GL_ANGLE_lossy_etc_decode" 
     "GL_EXT_texture_storage" 
     "GL_EXT_color_buffer_float" 
     "GL_OES_mapbuffer" 
     "GL_OES_get_program_binary" 
     "GL_EXT_texture_compression_dxt1" 
     "GL_ANGLE_texture_compression_dxt3" 
     "GL_EXT_texture_norm16" 
     "GL_ANGLE_multiview" 
     "GL_CHROMIUM_copy_compressed_texture" 
     "GL_CHROMIUM_color_buffer_float_rgba" 
     "GL_OES_packed_depth_stencil" 
     "GL_EXT_debug_marker" 
     "GL_OES_standard_derivatives" 
     "GL_OES_surfaceless_context" 
     "GL_ANGLE_client_arrays" 
     "GL_OES_texture_half_float_linear" 
     "GL_EXT_texture_filter_anisotropic" 

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

useBufferInvalidation (config option): false


Hardware Information

  GPU Acceleration: auto
  Memory: 32693 Mb
  Number of Cores: 16
  Swap Location: C:/Users/xi/AppData/Local/Temp

Current Settings

  Current Swap Location: C:/Users/xi/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: 2
	Screen: 0
		Name: \\.\DISPLAY1
		Depth: 32
		Scale: 1
		Resolution in pixels: 2560x1440
		Manufacturer: 
		Model: 
		Refresh Rate: 59
	Screen: 1
		Name: \\.\DISPLAY2
		Depth: 32
		Scale: 1
		Resolution in pixels: 1920x1080
		Manufacturer: 
		Model: 
		Refresh Rate: 60


---------------------
================================================================================
SESSION: 23 Dec 2021 17:50:11 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 10520
-- -- -- -- -- -- -- --
23 Dec 2021 17:50:11 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 17:50:31 +0800: Non-store package - creating updater
23 Dec 2021 17:50:56 +0800: Importing image/svg+xml to application/x-krita. Location: D:/twi-simpleicons.svg. Real location: D:/twi-simpleicons.svg. Batchmode: 0

KRITA DID NOT CLOSE CORRECTLY
================================================================================
SESSION: 23 Dec 2021 18:06:36 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 10680
-- -- -- -- -- -- -- --
23 Dec 2021 18:06:36 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 18:06:37 +0800: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at 周四 12月 23 17:50:15 2021
23 Dec 2021 18:06:39 +0800: Non-store package - creating updater
23 Dec 2021 18:18:28 +0800: CLOSING SESSION
================================================================================
SESSION: 23 Dec 2021 18:18:31 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 3228
-- -- -- -- -- -- -- --
23 Dec 2021 18:18:31 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 18:18:33 +0800: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at 周四 12月 23 17:50:15 2021
23 Dec 2021 18:18:35 +0800: Non-store package - creating updater
23 Dec 2021 18:18:40 +0800: Created image "Unnamed", 2480 * 3508 pixels, 300 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
23 Dec 2021 18:18:49 +0800: Importing image/svg+xml to application/x-krita. Location: D:/twi-simpleicons.svg. Real location: D:/twi-simpleicons.svg. Batchmode: 0
================================================================================
SESSION: 23 Dec 2021 18:21:18 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 12028
-- -- -- -- -- -- -- --
23 Dec 2021 18:21:18 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 18:21:20 +0800: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at 周四 12月 23 17:50:15 2021
23 Dec 2021 18:21:21 +0800: Non-store package - creating updater
23 Dec 2021 18:21:28 +0800: Importing image/svg+xml to application/x-krita. Location: D:/twi-simpleicons.svg. Real location: D:/twi-simpleicons.svg. Batchmode: 0
================================================================================
SESSION: 23 Dec 2021 18:26:41 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 1428
-- -- -- -- -- -- -- --
23 Dec 2021 18:26:41 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 18:26:42 +0800: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at 周四 12月 23 17:50:15 2021
23 Dec 2021 18:26:44 +0800: Non-store package - creating updater
23 Dec 2021 18:27:29 +0800: CLOSING SESSION
================================================================================
SESSION: 23 Dec 2021 18:27:30 +0800. Executing D:\P F\krita-x64-5.0.0\bin\krita.exe

Krita Version: 5.0.0, Qt version compiled: 5.12.12, loaded: 5.12.12. Process ID: 10452
-- -- -- -- -- -- -- --
23 Dec 2021 18:27:30 +0800: Style: fusion. Available styles: windowsvista, Windows, Fusion
23 Dec 2021 18:27:32 +0800: Database is up to date. Version: 0.0.15, created by Krita 5.0.0, at 周四 12月 23 17:50:15 2021
23 Dec 2021 18:27:34 +0800: Non-store package - creating updater

---------------------
Comment 1 wolthera 2021-12-23 10:41:25 UTC
Can confirm... Did this also happen in previous versions?
Comment 2 Eranthis stellata Maxim 2021-12-23 10:49:48 UTC
(In reply to wolthera from comment #1)
> Can confirm... Did this also happen in previous versions?

krita 4.4.8 can also trigger this bug.
Comment 3 Ahab Greybeard 2021-12-27 13:14:04 UTC
Created attachment 144895 [details]
Imported the twitter icon .svg file

I can Import this with the 5.0.0 appimage on Debian 10 with no problem.
The attached screenshot shows the original opened file with a size of 7px by 15 px off in the top left corner.
The larger image is after I drag-scaled it up in size.

My file viewer shows the bird image as it should be.

I can also Open the file to get the attached 'Opened-Twitter-Bird.png' result with an image size of 24px by 24px.
Comment 4 Ahab Greybeard 2021-12-27 13:14:48 UTC
Created attachment 144896 [details]
Opened Twitter Bird Icon
Comment 5 Eranthis stellata Maxim 2021-12-30 12:59:45 UTC
(In reply to Ahab Greybeard from comment #3)
> Created attachment 144895 [details]
> Imported the twitter icon .svg file
> 
> I can Import this with the 5.0.0 appimage on Debian 10 with no problem.
> The attached screenshot shows the original opened file with a size of 7px by
> 15 px off in the top left corner.
> The larger image is after I drag-scaled it up in size.
> 
> My file viewer shows the bird image as it should be.
> 
> I can also Open the file to get the attached 'Opened-Twitter-Bird.png'
> result with an image size of 24px by 24px.

This bug only appears under windows?
Comment 6 Ahab Greybeard 2021-12-30 14:44:03 UTC
Created attachment 144964 [details]
The bird .svg path opened as a path in GIMP

I forgot to test with Windows 10 :(

With the 5.0.0 appimage on Windows 10, the RAM usage increases rapidly with 'Very High' power usage and krita is unresponsive.

Krita appimage on Linux opens it and shows a malformed bird shape as seen in previous attachments.

Inkscape (on Linux and Windows) can open it with no apparent problems.

GIMP on (Linux and Windows) can open it as an image of the correct shape as a Layer content, i.e. raster image.
However, if GIMP opens it as a path then it is very strange, as seen by the path (in pink) in the attached screenshot - "GIMP-bird-path.png".
That path may have similarities with the shape presented by krita, depending how you look at it.

Inkscape seems to have a correct path as tested by marking the path and seeing the result.

The .svg file itself is unusual in various ways:

It is very 'bare bones' and has none of the metadata usually associated with vector applications.

It has a role = "img" statement which I believe is used for giving 'hints' to browsers.
I tried removing that but it made no difference.

The bird shape is a path but it has no style-line-fill-join-colour- etc information, it's a bare path.
Maybe it relies on standard default values for those.

I tried using that path to replace the bare path data of a 'well formed' .svg file and that then showed the same appearance in krita. 
So, it seems to be something about the path itself that krita does not get along with, especially on Windows.
Comment 7 Ahab Greybeard 2021-12-30 14:47:12 UTC
Correction for Comment 6:
It should say " With the 5.0.0 portable .zip on Windows 10", NOT "With the 5.0.0 appimage on Windows 10".
Comment 8 sh_zam 2022-01-19 10:46:02 UTC
Git commit 36654c666907bc59e12e9c6421c8285e2d9bf5fd by Sharaf Zaman.
Committed on 19/01/2022 at 10:42.
Pushed by szaman into branch 'master'.

Bugfix: Properly handle flags in SVG path

We treated flags ("0" | "1") in elliptical path data as coords, which
isn't correct.

M  +20   -5    libs/flake/KoPathShapeLoader.cpp
M  +21   -0    libs/flake/tests/TestSvgParser.cpp
M  +1    -0    libs/flake/tests/TestSvgParser.h
A  +-    --    libs/flake/tests/data/svg_render/load_elliptical_arc.png

https://invent.kde.org/graphics/krita/commit/36654c666907bc59e12e9c6421c8285e2d9bf5fd
Comment 9 sh_zam 2022-03-01 09:00:33 UTC
Git commit 766b22dc55ae36e176654fbcdcba24a5173e7fe1 by Sharaf Zaman.
Committed on 01/03/2022 at 08:31.
Pushed by szaman into branch 'krita/5.0'.

Bugfix: Properly handle flags in SVG path

We treated flags ("0" | "1") in elliptical path data as coords, which
isn't correct.
(cherry picked from commit 36654c666907bc59e12e9c6421c8285e2d9bf5fd)

M  +20   -5    libs/flake/KoPathShapeLoader.cpp
M  +21   -0    libs/flake/tests/TestSvgParser.cpp
M  +1    -0    libs/flake/tests/TestSvgParser.h
A  +-    --    libs/flake/tests/data/svg_render/load_elliptical_arc.png

https://invent.kde.org/graphics/krita/commit/766b22dc55ae36e176654fbcdcba24a5173e7fe1