Bug 518465 - Deleting top layer causes new view of image to have no active layer
Summary: Deleting top layer causes new view of image to have no active layer
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (other bugs)
Version First Reported In: 5.3.1
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-04-02 22:06 UTC by vurentjie
Modified: 2026-06-12 13:11 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Recording of the layer being deselected instead of auto-selected (3.85 MB, video/mp4)
2026-04-02 22:06 UTC, vurentjie
Details
patch with some quickfix (872 bytes, patch)
2026-04-04 16:09 UTC, vurentjie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vurentjie 2026-04-02 22:06:37 UTC
Created attachment 191225 [details]
Recording of the layer being deselected instead of auto-selected

SUMMARY
This is a really minor issue. I will report it and maybe look into a fix later.

I noticed if I delete the topmost layer in a document and create a new view of that document, almost every time I first need to click on any layer in layer docker to activate it. 

STEPS TO REPRODUCE
1. Create a new image
2. Delete the topmost layer
3. Select Window > New View > create a new view of the document

OBSERVED RESULT
Unable to operate on canvas without clicking on layer docker first.

EXPECTED RESULT
Layer should be selected automatically and can just continue working.

SOFTWARE/OS VERSIONS
 Version: 5.3.1 (git 9069dbc)
 Hidpi: true

Qt
  Version (compiled): 5.15.7
  Version (loaded): 5.15.7

OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 6.17.0-19-generic
  Pretty Productname: Ubuntu 24.04.4 LTS
  Product Type: ubuntu
  Product Version: 24.04
  Desktop: ubuntu:GNOME
  Appimage build: Yes

ADDITIONAL INFORMATION
I can reproduce this on MacOS and Windows as well.
Comment 1 Freya Lupen 2026-04-04 13:03:59 UTC
Confirmed (on 6.0.0). This seemingly minor issue is actually a big problem, since having no layer active can lead to crashes when trying to use a tool that doesn't expect this (for instance, the Text Tool).
Comment 2 vurentjie 2026-04-04 16:09:04 UTC
Created attachment 191276 [details]
patch with some quickfix

Interesting. I did not submit any merge request because I was not entirely conviced with my current solution. But will attach a patch on this ticket for now to inspect. The reasons I was not convinced about my fix is 
a) it just ensures any layer gets activated not necessarily the layer that was previously active on the other view 
b) my fix might be masking the real cause/change that occurred for this to start happening
Comment 3 vurentjie 2026-06-05 14:07:19 UTC
This seems to be fixed now in 5.3.2.1. 
I believe this change: https://invent.kde.org/graphics/krita/-/merge_requests/2803
Comment 4 vurentjie 2026-06-05 14:09:37 UTC
(In reply to vurentjie from comment #3)
> This seems to be fixed now in 5.3.2.1. 
> I believe this change:
> https://invent.kde.org/graphics/krita/-/merge_requests/2803

Correction it is not fixed. Sorry. Re-opened.
Comment 5 vurentjie 2026-06-05 19:45:44 UTC
Had a look at this issue again tonight. I created a merge request here with a possible fix: https://invent.kde.org/graphics/krita/-/merge_requests/2817
Comment 6 Dmitry Kazakov 2026-06-12 13:10:22 UTC
Git commit a68892a3acdbaace02268d97808a109e66bf401b by Dmitry Kazakov, on behalf of Gregg Jansen van Vuren.
Committed on 12/06/2026 at 12:42.
Pushed by dkazakov into branch 'master'.

Ensure a layer is activated for new views

Fixes a bug when deleting the topmost layer and then
opening a new view. When the new view opens none of
the layers are activated, you first need to click
inside the dockers panel.

M  +5    -0    libs/ui/flake/kis_dummies_facade_base.cpp
M  +1    -0    libs/ui/flake/kis_dummies_facade_base.h
M  +1    -0    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/a68892a3acdbaace02268d97808a109e66bf401b
Comment 7 Dmitry Kazakov 2026-06-12 13:11:37 UTC
Git commit 48f54e2b9f6bf565cbd76c6ef49bfe704bfea4a7 by Dmitry Kazakov, on behalf of Gregg Jansen van Vuren.
Committed on 12/06/2026 at 13:11.
Pushed by dkazakov into branch 'krita/6.0'.

Ensure a layer is activated for new views

Fixes a bug when deleting the topmost layer and then
opening a new view. When the new view opens none of
the layers are activated, you first need to click
inside the dockers panel.

M  +5    -0    libs/ui/flake/kis_dummies_facade_base.cpp
M  +1    -0    libs/ui/flake/kis_dummies_facade_base.h
M  +1    -0    libs/ui/kis_node_manager.cpp

https://invent.kde.org/graphics/krita/-/commit/48f54e2b9f6bf565cbd76c6ef49bfe704bfea4a7