<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>480718</bug_id>
          
          <creation_ts>2024-02-02 04:51:03 +0000</creation_ts>
          <short_desc>[master] Opening documents always selects the Background layer</short_desc>
          <delta_ts>2024-04-10 16:12:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>krita</product>
          <component>Layer Stack</component>
          <version>nightly build (please specify the git hash!)</version>
          <rep_platform>Appimage</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>regression</keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>tomtomtomreportingin</reporter>
          <assigned_to name="Krita Bugs">krita-bugs-null</assigned_to>
          <cc>acc4commissions</cc>
    
    <cc>lynx.mw+kde</cc>
    
    <cc>penguinflyer2222</cc>
          
          <cf_commitlink>https://invent.kde.org/graphics/krita/-/commit/4ded66b083057cb4e574f2f21159a19279d7da49</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2285298</commentid>
    <comment_count>0</comment_count>
    <who name="">tomtomtomreportingin</who>
    <bug_when>2024-02-02 04:51:03 +0000</bug_when>
    <thetext>git a8f6ca2

SUMMARY
Opening documents always selects the Background layer, which is often locked. Note: this does not occur when creating new documents.

STEPS TO REPRODUCE
1. Open a recent document with two layers.
2. Observe the layer stack.

OBSERVED RESULT
The Background layer is selected.

EXPECTED RESULT
The last used layer should be selected.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian Sid
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10 (appimage)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2285490</commentid>
    <comment_count>1</comment_count>
    <who name="Freya Lupen">penguinflyer2222</who>
    <bug_when>2024-02-02 19:16:07 +0000</bug_when>
    <thetext>Confirmed, regression of commit 8dc97144.

With a single layer document (.png file for example), there is instead no layer selected at all.
That leads to the crash mentioned here:
https://invent.kde.org/graphics/krita/-/commit/8dc97144531e42055a2d31918c4674e30e1a7026#note_860048
when selecting the Transform Tool in Fast mode.

May be related to bug 480331.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2301021</commentid>
    <comment_count>2</comment_count>
    <who name="Freya Lupen">penguinflyer2222</who>
    <bug_when>2024-03-14 20:27:58 +0000</bug_when>
    <thetext>The exact change that caused this regression seems to be this in KisSynchronizedConnectionBase::postEvent() :
&gt; -    if (QThread::currentThread() == this-&gt;thread()) {
&gt; +    if (s_instance-&gt;enableAutoModeForUnittests &amp;&amp; QThread::currentThread() == this-&gt;thread()) {
which causes the &apos;else&apos; path to be taken.

In that path, the order of events when loading the document seems to change from
&gt; KisDummiesFacadeBase::slotNodeAdded, KisDummiesFacadeBase::slotContinueAddNode, KisDummiesFacadeBase::slotNodeAdded, KisDummiesFacadeBase::slotContinueAddNode, KisDummiesFacadeBase::slotNodeActivationRequested, KisView::slotLoadingFinished
to
&gt; KisDummiesFacadeBase::slotNodeAdded, KisDummiesFacadeBase::slotNodeAdded, KisView::slotLoadingFinished, KisDummiesFacadeBase::slotContinueAddNode, KisDummiesFacadeBase::slotContinueAddNode, KisDummiesFacadeBase::slotNodeActivationRequested
KisView::slotLoadingFinished being where the current node is set.
I&apos;m guessing this reordering is the cause of this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2305452</commentid>
    <comment_count>3</comment_count>
    <who name="Freya Lupen">penguinflyer2222</who>
    <bug_when>2024-03-25 16:23:33 +0000</bug_when>
    <thetext>*** Bug 481924 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2310024</commentid>
    <comment_count>4</comment_count>
    <who name="Lynx3d">lynx.mw+kde</who>
    <bug_when>2024-04-10 08:51:56 +0000</bug_when>
    <thetext>This bug seems to have more confusing side effects too.
If you create a new image from clipboard (Ctrl+Shift+N), then the layers docker has no active layer at all, and while you can for some reason paint on it with the brush tool, transform tool says &quot;Cannot transform empty layer&quot;, and trying to copy a selected area will even error out with a safe assert.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2310113</commentid>
    <comment_count>5</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2024-04-10 15:39:50 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2115</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2310132</commentid>
    <comment_count>6</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2024-04-10 16:11:30 +0000</bug_when>
    <thetext>Git commit 1079c7f1f7e32aace1fcf7a5155d2841ca25ab7e by Dmitry Kazakov.
Committed on 10/04/2024 at 15:34.
Pushed by dkazakov into branch &apos;master&apos;.

Fix activation of the node on opening .kra document

Since KisDummiesFacadeBase::setImage() is now executed asyncronously
the node activation that used to happen in KisView::slotLoadingFinished()
now doesn&apos;t work anymore. Hence we should just instruct
KisDummiesFacadeBase::setImage() itself, which node it should activate
at the end of image loading into dummies graph.

M  +2    -2    libs/ui/KisDocument.cpp
M  +1    -1    libs/ui/KisDocument.h
M  +0    -11   libs/ui/KisView.cpp
M  +10   -1    libs/ui/flake/kis_dummies_facade_base.cpp
M  +2    -1    libs/ui/flake/kis_dummies_facade_base.h
M  +2    -2    libs/ui/flake/kis_shape_controller.cpp
M  +2    -1    libs/ui/flake/kis_shape_controller.h
M  +22   -2    libs/ui/tests/kis_dummies_facade_base_test.cpp
M  +1    -0    libs/ui/tests/kis_dummies_facade_base_test.h
M  +3    -4    plugins/impex/kra/kra_import.cpp
M  +2    -4    plugins/impex/ora/ora_import.cc

https://invent.kde.org/graphics/krita/-/commit/1079c7f1f7e32aace1fcf7a5155d2841ca25ab7e</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2310133</commentid>
    <comment_count>7</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2024-04-10 16:12:07 +0000</bug_when>
    <thetext>Git commit 4ded66b083057cb4e574f2f21159a19279d7da49 by Dmitry Kazakov.
Committed on 10/04/2024 at 16:12.
Pushed by dkazakov into branch &apos;krita/5.2&apos;.

Fix activation of the node on opening .kra document

Since KisDummiesFacadeBase::setImage() is now executed asyncronously
the node activation that used to happen in KisView::slotLoadingFinished()
now doesn&apos;t work anymore. Hence we should just instruct
KisDummiesFacadeBase::setImage() itself, which node it should activate
at the end of image loading into dummies graph.


(cherry picked from commit 1079c7f1f7e32aace1fcf7a5155d2841ca25ab7e)

M  +2    -2    libs/ui/KisDocument.cpp
M  +1    -1    libs/ui/KisDocument.h
M  +0    -11   libs/ui/KisView.cpp
M  +10   -1    libs/ui/flake/kis_dummies_facade_base.cpp
M  +2    -1    libs/ui/flake/kis_dummies_facade_base.h
M  +2    -2    libs/ui/flake/kis_shape_controller.cpp
M  +2    -1    libs/ui/flake/kis_shape_controller.h
M  +22   -2    libs/ui/tests/kis_dummies_facade_base_test.cpp
M  +1    -0    libs/ui/tests/kis_dummies_facade_base_test.h
M  +3    -4    plugins/impex/kra/kra_import.cpp
M  +2    -4    plugins/impex/ora/ora_import.cc

https://invent.kde.org/graphics/krita/-/commit/4ded66b083057cb4e574f2f21159a19279d7da49</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>