Bug 426701

Summary: Error message when saving Krita comic project
Product: krita Reporter: jeyek35639
Component: ScriptingAssignee: Tiar <tamtamy.tymona>
Status: RESOLVED FIXED    
Severity: minor CC: cybermotroncom, tamtamy.tymona
Priority: NOR    
Version: 4.4.1   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: Error message contents

Description jeyek35639 2020-09-18 21:50:32 UTC
Created attachment 131754 [details]
Error message contents

SUMMARY

When saving a comic project in Krita, a weird error message shows up. AFAIK the error is only cosmetic. For all intents and purposes you can do whatever you want in Krita and your work can be saved and loaded.

STEPS TO REPRODUCE
1. Create a comic project
2. Draw something
3. Save your project
4. Error message appears (sometimes, IDK why)

OBSERVED RESULT

Error message comes up when saving

EXPECTED RESULT

I expect to not receive these error messages

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

I attached the full text of the error message in a notepad file.
Comment 1 Tiar 2020-09-19 01:55:37 UTC
Thanks for reporting!
Since it looks like you're using 4.2.9, can you please check version 4.3.0 or, preferably, Krita Plus from the website if it isn't fixed in the newest version already?
Comment 2 jeyek35639 2020-09-19 20:14:18 UTC
(In reply to Tymond from comment #1)
> Thanks for reporting!
> Since it looks like you're using 4.2.9, can you please check version 4.3.0
> or, preferably, Krita Plus from the website if it isn't fixed in the newest
> version already?

I was under the impression that Krita auto-updates, but if there is a 4.3.0 then I'll test that and report back.
Comment 3 jeyek35639 2020-09-19 21:21:42 UTC
(In reply to Tymond from comment #1)
> Thanks for reporting!
> Since it looks like you're using 4.2.9, can you please check version 4.3.0
> or, preferably, Krita Plus from the website if it isn't fixed in the newest
> version already?

I uninstalled my Krita and bought and installed the Steam version. The same error message came up right now.
Comment 4 Bug Janitor Service 2020-09-20 04:33:13 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 5 Tiar 2020-10-15 23:20:59 UTC
Do you think it's possible that it always happen when you have multiple pages saved nearly at the same time? (More than one).
Comment 6 Tiar 2020-10-16 00:40:20 UTC
Git commit 44a0f2258fe301245bf979bf9df3c907c876cf22 by Agata Cacko.
Committed on 16/10/2020 at 00:28.
Pushed by tymond into branch 'master'.

Fix Comic Manager race when updating multiple files

Before this commit, in case of updating multiple files at once,
for example when copying files into the `pages` directory to
overwrite existing ones, the following would happen:

signal filechanged(file1) -> url = file1 -> wait 200ms ->
    slot updatefile (update `url` file) -> url = ""

signal filechanged(file2) -> url = file2 -> wait 200ms ->
    slot updatefile (update `url` file) -> url = ""

When you update both file1 and file2 at once, a race condition
would happen and the exact sequence on the timeline would look more like
this:

signal filechanged(file1) -> url = file1 -> signal filechanged(file2)
   -> url = file2 -> wait 200ms -> slot updatefile (update `url` file,
   which is now `file2`) -> url = "" -> slot updatefile (update `url`
   file, which is now... an empty string

Then the plugin would crash on `realpath()` because the url is empty
and there is no check for that.

This commit fixes the behaviour by keeping a list of files to update.
That way in the first phase when lots of `filechanged` signals arrive,
all files to update are saved into a list and then after 200ms popped
from the list and updated one by one.

The most elegant solution would be to have QTimer keep the url,
it would be also possible to make the updatefile slot just update all
files from the list and return if the list is empty, but it's not
necessary because the signals will eventually arrive in the correct
number.

M  +36   -31   plugins/python/comics_project_management_tools/comics_project_manager_docker.py

https://invent.kde.org/graphics/krita/commit/44a0f2258fe301245bf979bf9df3c907c876cf22
Comment 7 Tiar 2020-10-16 00:41:01 UTC
Git commit ec086e45378ec8bb5111d3bf564bb56f548978b5 by Agata Cacko.
Committed on 16/10/2020 at 00:40.
Pushed by tymond into branch 'krita/4.3'.

Fix Comic Manager race when updating multiple files

Before this commit, in case of updating multiple files at once,
for example when copying files into the `pages` directory to
overwrite existing ones, the following would happen:

signal filechanged(file1) -> url = file1 -> wait 200ms ->
    slot updatefile (update `url` file) -> url = ""

signal filechanged(file2) -> url = file2 -> wait 200ms ->
    slot updatefile (update `url` file) -> url = ""

When you update both file1 and file2 at once, a race condition
would happen and the exact sequence on the timeline would look more like
this:

signal filechanged(file1) -> url = file1 -> signal filechanged(file2)
   -> url = file2 -> wait 200ms -> slot updatefile (update `url` file,
   which is now `file2`) -> url = "" -> slot updatefile (update `url`
   file, which is now... an empty string

Then the plugin would crash on `realpath()` because the url is empty
and there is no check for that.

This commit fixes the behaviour by keeping a list of files to update.
That way in the first phase when lots of `filechanged` signals arrive,
all files to update are saved into a list and then after 200ms popped
from the list and updated one by one.

The most elegant solution would be to have QTimer keep the url,
it would be also possible to make the updatefile slot just update all
files from the list and return if the list is empty, but it's not
necessary because the signals will eventually arrive in the correct
number.


(cherry picked from commit 44a0f2258fe301245bf979bf9df3c907c876cf22)

M  +36   -31   plugins/python/comics_project_management_tools/comics_project_manager_docker.py

https://invent.kde.org/graphics/krita/commit/ec086e45378ec8bb5111d3bf564bb56f548978b5
Comment 8 Tiar 2020-10-16 00:46:40 UTC
@jeyek - the bug has been now fixed and backported; which means that you can wait 24h from now and then go to krita.org and download the version that is called "Krita Plus" from the website. Please do check and confirm if the bug is fixed for you there.

The Krita Plus version should be rather stable but there are some new features that don't appear in Krita 4.4.0, so take that into account when making a decision whether you want to use it for everyday usage.
Comment 9 Maurice Campobasso 2020-11-04 05:08:51 UTC
Despite this bug being fixed in Krita Plus it has returned in Krita 4.4.1
Comment 10 Tiar 2020-11-05 01:13:34 UTC
Hi, it happens in Krita 4.4.1 because Krita 4.4.1 has very minimal set of bug fixes over Krita 4.4.0. It was released like a week or two after the release of 4.4.0 and it was because it was an emergency release, not a normal release. Hence it doesn't have this bug fix. Please either use Krita Plus or wait until next Krita (which appears to be named Krita 4.4.3 because we used up 4.4.2 in Windows Store? Sorry, I know it's confusing a bit :) But the next version should be around a month and a half from now, it will be just the next big version with a huge list of bug fixes and some new features).
Comment 11 Maurice Campobasso 2020-11-05 02:26:36 UTC
No worries. Thanks for the clarification. :)