Bug 506769

Summary: Gradient button on toolbar is "undefined" if Krita is closed after selecting a custom gradient with a custom tag
Product: [Applications] krita Reporter: Noel Santos <noel>
Component: Resource ManagementAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Noel Santos 2025-07-08 18:02:38 UTC
SUMMARY

The gradient button on the toolbar becomes empty/blank after reloading Krita with a custom gradient selected, which leads to crashes under some circumstances, e.g. https://bugs.kde.org/show_bug.cgi?id=505986

STEPS TO REPRODUCE
1. Click on the gradient button the toolbar
2. Add a new gradient called "Black to White"
3. Add a new gradient tag called "Basic Gradients"
4. Tag the gradient with the tag.
5. Select the "Basic Gradients" tag
6. Select the "Black to White" gradient
7. Close Krita
8. Open Krita
9. Create a new document

OBSERVED RESULT

The gradient button is empty.

EXPECTED RESULT

The gradient that I selected before should be displayed, or some valid fallback gradient should be selected.

SOFTWARE/OS VERSIONS
I'm on Linux Mint.
Git hash: 3cc9811

ADDITIONAL INFORMATION

This bug is partially documented on this thread https://krita-artists.org/t/linux-mint-users-lets-try-crashing-krita-with-the-index-colors-filter/128334/

Empty button: https://krita-artists.org/uploads/default/original/3X/2/8/28e60d57e8351739171af81b4c55786b5b7967a1.png

Dropdown with valid gradient selected: https://krita-artists.org/uploads/default/original/3X/7/c/7cc5eb0c0cb2b228b8b9b88d534030fa23b0b6f5.png
Comment 1 Dmitry Kazakov 2026-01-27 10:35:40 UTC
I can confirm the issue in master
Comment 2 Dmitry Kazakov 2026-01-30 13:16:49 UTC
Git commit 70f7a650cc8b9f437d4ee35e2296f26f83c1822a by Dmitry Kazakov.
Committed on 30/01/2026 at 13:16.
Pushed by dkazakov into branch 'master'.

Fix initialization of the gradient button's thumbnail

If the gradient selector has the tag-filtering enabled, then
the default Fg-to-Transparent gradient will not be available
on startup. Hence we should enable it on the global canvas
resource manager separately and accept that the gradient
chooser will not have anything selected at all.

M  +13   -8    libs/ui/kis_control_frame.cpp
M  +1    -0    libs/ui/kis_control_frame.h

https://invent.kde.org/graphics/krita/-/commit/70f7a650cc8b9f437d4ee35e2296f26f83c1822a