Created attachment 138974 [details] Steps to reproduce the bug SUMMARY Newly created gamut mask will not appear in the selector even though the kgm file exist in the resource folder. However, the copy of the gamut mask will appear if the duplicate button is clicked afterwards. Sometimes this does not work and clicking on the gamut mask in edit mode may cause Krita to crash. STEPS TO REPRODUCE 1. Create a new mask on the gamut mask docker and name the gamut mask 2. Make a mask on the opened colour wheel document using vector tools. 3. Click save on the gamut mask docker and save the mask document. OBSERVED RESULT The gamut mask does not appear in the selector. EXPECTED RESULT The gamut mask should appear in the selector. SOFTWARE/OS VERSIONS Krita version: 5.0.0-prealpha (git db6406a) Languages: en_GB, en, en_US, en Hidpi: true Windows: Windows 10 Pro Qt Version: Version (compiled): 5.12.9 Version (loaded): 5.12.9 ADDITIONAL INFORMATION Clicking duplicate button after creating the mask sometimes allow the copy of that gamut mask to appear. It will not work sometimes. Clicking on the copy of the mask before saving will cause Krita to crash. This bug does not exist in Krita version 4.4.3.
Git commit 1269be2c64ad5ceeb6638d85745346b3dc2b1a40 by Agata Cacko. Committed on 09/06/2021 at 12:29. Pushed by tymond into branch 'master'. Fix saving new gamut masks Before this commit, gamut masks docker would use KoResourceServer to manage resources, and always add the gamut mask as a new resource, even if it already existed. This commit makes it use KisResourceModel instead (the newer resource API) and only updates the resource instead of adding it again. Right now creating a new mask should work as long as the name doesn't change (which is possible when editing the newly created mask). M +33 -23 libs/flake/resources/KoGamutMask.cpp M +22 -6 plugins/dockers/gamutmask/gamutmask_dock.cpp https://invent.kde.org/graphics/krita/commit/1269be2c64ad5ceeb6638d85745346b3dc2b1a40
Git commit 66358f1b95c117a49d69335586e83385e9a61138 by Agata Cacko. Committed on 09/06/2021 at 12:29. Pushed by tymond into branch 'master'. Fix duplicate mask in Gamut Masks docker Before this commit, duplicating a mask would just edit the old one. That's because the resource id wasn't reset to -1 after cloning. This commit ensures the resource id is reset, so later it won't be able to find the resource in the resource model and it will add it to Krita as a new resource. M +2 -0 plugins/dockers/gamutmask/gamutmask_dock.cpp https://invent.kde.org/graphics/krita/commit/66358f1b95c117a49d69335586e83385e9a61138
It would be awesome if you could check if I fixed everything that was broken :) (Except for the dialog asking you to save the .kra document; that will be fixed in https://invent.kde.org/graphics/krita/-/merge_requests/898; you can just click "Cancel" there and it will still work correctly).
(In reply to Tiar from comment #3) > It would be awesome if you could check if I fixed everything that was broken > :) (Except for the dialog asking you to save the .kra document; that will be > fixed in https://invent.kde.org/graphics/krita/-/merge_requests/898; you can > just click "Cancel" there and it will still work correctly). Hi, I checked the newest nightly ( 5.0.0-prealpha (git c4e3b84)) and creating gamut masks works as expected. I tried duplicating masks and although I experienced crash twice when cancelling the mask creation, I did not experience crash anymore after that. Cancelling duplication of mask works afterwards but when I try to create a copy of the mask with the same name as the cancelled mask, the copy won't appear. However, deleting the mask in the resource folder and restarting Krita allow the mask with the same name to appear in the docker again. I think it is better to allow deleting resource right from the resource manager instead of having to go to the folder since it may cause confusion to unaware users but I think it is more related to resource manager. As for the bug itself, I think it is resolved so thank you so much for the fix.
Thanks for checking! I'm reopening the bug anyway, though I plan to fix it today or next week. > I tried duplicating masks and although I experienced crash twice when cancelling the mask creation, I did not experience crash anymore after that. I see you're on Windows, can you please check Help -> Show Krita log for bug reports if there is a crash log? It would be really helpful to make sure those crashes will be fixed and won't happen again. For the issue you're noticing, am I correct that it happens like this: 1) Press duplicate a mask with the, let's say, complimentary mask selected; 2) Write name like "MyMask"; 3) When you see the document open, press Cancel in the Gamut Masks docker; 4) Press duplicate a mask on the complimentary mask again; 5) Write name "MyMask" 6) Finish creating a mask 7) The mask doesn't appear 8) Go to resource folder, remove the old mask (how is the file called, exactly? I know it would have '?' preview but it would have to be called MyMask.kgm, isn't it?) 9) Go to Resource Manager, the new mask appears Is that correct? If not, please correct me. I guess the reason it happens is because the Gamut Masks docker first adds the resource and then edit it instead of adding when you save the mask. So, then Krita won't allow you to create a mask with the same name... but the GUI is not enough to tell the user... That needs to be fixed.
(In reply to Tiar from comment #5) > Thanks for checking! I'm reopening the bug anyway, though I plan to fix it > today or next week. > > > I tried duplicating masks and although I experienced crash twice when cancelling the mask creation, I did not experience crash anymore after that. > > I see you're on Windows, can you please check Help -> Show Krita log for bug > reports if there is a crash log? It would be really helpful to make sure > those crashes will be fixed and won't happen again. > > For the issue you're noticing, am I correct that it happens like this: > 1) Press duplicate a mask with the, let's say, complimentary mask selected; > 2) Write name like "MyMask"; > 3) When you see the document open, press Cancel in the Gamut Masks docker; > 4) Press duplicate a mask on the complimentary mask again; > 5) Write name "MyMask" > 6) Finish creating a mask > 7) The mask doesn't appear > 8) Go to resource folder, remove the old mask (how is the file called, > exactly? I know it would have '?' preview but it would have to be called > MyMask.kgm, isn't it?) > 9) Go to Resource Manager, the new mask appears > Is that correct? If not, please correct me. > > I guess the reason it happens is because the Gamut Masks docker first adds > the resource and then edit it instead of adding when you save the mask. So, > then Krita won't allow you to create a mask with the same name... but the > GUI is not enough to tell the user... That needs to be fixed. There seems to be no crash log in the krita log,however there is mention of 2 instance of error in the kritacrash log in localappdata.Let me know if you need the error logs. As for duplicating the mask, after step 5, it will ask to overwrite the mask first before creating it then the mask does not appear. Then, after step 8, aside from deleting the mask in the resource folder (it will have the same filename as the mask name in .kgm format), Krita needs to be restarted first, then duplicating the mask with the same name will allow it to appear. Maybe the one thing that causes confusion was that Krita offers to overwrite the mask.
> There seems to be no crash log in the krita log,however there is mention of 2 instance of error in the kritacrash log in localappdata.Let me know if you need the error logs. Please create a *new* bug report and attach both of those crash logs as an attachment, will you? You can mark the Importance as "crash" when creating the report. I (hopefully) finished fixing this bug, it will close soon when I push to master.
(In reply to Tiar from comment #7) > > There seems to be no crash log in the krita log,however there is mention of 2 instance of error in the kritacrash log in localappdata.Let me know if you need the error logs. > > Please create a *new* bug report and attach both of those crash logs as an > attachment, will you? You can mark the Importance as "crash" when creating > the report. > > I (hopefully) finished fixing this bug, it will close soon when I push to > master. I created the bug report, (In reply to Tiar from comment #7) > > There seems to be no crash log in the krita log,however there is mention of 2 instance of error in the kritacrash log in localappdata.Let me know if you need the error logs. > > Please create a *new* bug report and attach both of those crash logs as an > attachment, will you? You can mark the Importance as "crash" when creating > the report. > > I (hopefully) finished fixing this bug, it will close soon when I push to > master. I have created the bug report and attached the crash logs. Thank you in advance for the fix.
Git commit 5df4b578bb968e875603d7fc59194c980e0abd13 by Agata Cacko. Committed on 21/06/2021 at 13:40. Pushed by tymond into branch 'master'. Avoid saving gamut masks prematurely Before this commit, a gamut mask would always be saved during creation, and then after the user edited it to be what they wanted it to be. It meant two issues: - the first usable version of the gamut mask was actually the second version in the versioned_resources, - if the user cancelled the creation and then tried to create a gamut mask under the same name, it would fail This commit fixes it by ensuring that saving only happens when the user presses "Save" button. M +4 -8 plugins/dockers/gamutmask/gamutmask_dock.cpp https://invent.kde.org/graphics/krita/commit/5df4b578bb968e875603d7fc59194c980e0abd13