Bug 446832

Summary: Removed file layer generate warnings when linked file doesn't exists anymore
Product: [Applications] krita Reporter: grum999
Component: Layer StackAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, halla
Priority: NOR    
Version First Reported In: 5.0.0-beta5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description grum999 2021-12-11 14:46:28 UTC
SUMMARY

Krita's generate warning messages when file from a removed file layer doesn't exist anymore.



STEPS TO REPRODUCE - CASE 1
1. Create/Open a document 
2. Add a file layer, linked to file /home/user/xxxx.jpg (for example)
3. Remove file layer 
4. Save document
5. Delete file /home/user/xxxx.jpg
6. Wait 10seconds, and then every 10seconds, the message is printed in terminal:
-----
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 10 seconds"
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 20 seconds"
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 30 seconds"
...
-----
7. Close document
The warning message still continue to be printed even if document is closed...


STEPS TO REPRODUCE - CASE 2
1. Create/Open a document 
2. Add a file layer, linked to file /home/user/xxxx.jpg (for example)
4. Save document
5. Close document
6. Delete file /home/user/xxxx.jpg
7. Wait 10seconds, and then every 10seconds, the message is printed in terminal:
-----
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 10 seconds"
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 20 seconds"
"WARNING: couldn't reconnect to a removed file layer's file (/home/user/xxxx.jpg). File is not available for 30 seconds"
...
-----



OBSERVED RESULT
Krita tries to keep a connection to linked file even if file layer is removed.

As error message is displayed when file doesn't exists anymore, it seems that Krita keep a connection to file even if not needed anymore (file layer removed, document closed)

EXPECTED RESULT
When file layer is removed, link to file should be completely stopped.
Also, when a document is closed, link to file should be completely stopped.


SOFTWARE/OS VERSIONS
Krita
 Version: 5.0.0-beta5

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

OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-18-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: KDE

ADDITIONAL INFORMATION
Problem was already here with Krita 4.4.7 didn't tested previous version)
Comment 1 Dmitry Kazakov 2021-12-14 06:38:55 UTC
Hi, grum999!

Thanks for your report! I can see how this bug can happen, that is rather funny bug :) I'll have a look.
Comment 2 Dmitry Kazakov 2022-04-20 11:14:34 UTC
Git commit 3d2223f53c73b03692b8ae6429809602b6d72a12 by Dmitry Kazakov.
Committed on 20/04/2022 at 09:45.
Pushed by dkazakov into branch 'master'.

Let File Layers report errors with filesystem via node properties

Now the user can see an exclamation mark near the file layer's name
when the layer fails to access/parse the linked file. The user can hover
the exclamation mark and see what actually hapened.

M  +16   -1    libs/image/kis_layer_properties_icons.cpp
M  +3    -0    libs/image/kis_layer_properties_icons.h
M  +37   -0    libs/ui/kis_file_layer.cpp
M  +13   -0    libs/ui/kis_file_layer.h
M  +56   -31   plugins/dockers/layerdocker/NodeDelegate.cpp
M  +16   -0    plugins/dockers/layerdocker/NodeToolTip.cpp

https://invent.kde.org/graphics/krita/commit/3d2223f53c73b03692b8ae6429809602b6d72a12