sd/source/ui/framework/factories/ChildWindowPane.cxx |    4 ++
 sd/source/ui/inc/ViewShellManager.hxx                |    5 +++
 sd/source/ui/view/ViewShellManager.cxx               |   28 +++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit ae281b51456196246a5b21929f6624bf6c030294
Author:     Sarper Akdemir <sarper.akde...@allotropia.de>
AuthorDate: Mon Dec 2 12:45:27 2024 +0100
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Mon Dec 2 15:46:14 2024 +0100

    tdf#163948: fix crash when NotesPane is enabled on Tabbed UI
    
    Pane shells (BottomImpressPane, LeftImpressPane etc.) do not implement any 
slot
    handling, so make sure they are not activated on the top of the shellstack.
    
    Another solution for this could have been getting ChildWindowPanes properly
    dispose instead of Hide() at BasicPaneFactory::releaseResource, and 
adapting the
    rest of the code which assumes these Panes are recycled.
    
    This is since ConfigurationUpdater::UpdateCore attempts at releasing via
    ConfigurationUpdater::CheckPureAnchors and
    ConfigurationControllerResourceManager::DeactivateResources calls.
    
    But in the end the ChildWindowPane is hidden on the DeactivateResource call
    instead of being diposed, so the "PureAnchor"'s Shell stays at the 
shellstack.
    
    Change-Id: I52788d350b66ae22875683f57d87326f4a9a77de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177686
    Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx 
b/sd/source/ui/framework/factories/ChildWindowPane.cxx
index 1eaf0f0aeeb2..6e9e237c166f 100644
--- a/sd/source/ui/framework/factories/ChildWindowPane.cxx
+++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx
@@ -48,7 +48,9 @@ ChildWindowPane::ChildWindowPane (
       mpShell(std::move(pShell)),
       mbHasBeenActivated(false)
 {
-    mrViewShellBase.GetViewShellManager()->ActivateShell(mpShell.get());
+    // ChildWindowPane shells don't implement dispatch slots, so activate them
+    // at the bottom of the shellstack.
+    
mrViewShellBase.GetViewShellManager()->ActivateLowPriorityShell(mpShell.get());
 
     SfxViewFrame& rViewFrame = mrViewShellBase.GetViewFrame();
 
diff --git a/sd/source/ui/inc/ViewShellManager.hxx 
b/sd/source/ui/inc/ViewShellManager.hxx
index 70fe4d548cbe..929877ad1484 100644
--- a/sd/source/ui/inc/ViewShellManager.hxx
+++ b/sd/source/ui/inc/ViewShellManager.hxx
@@ -88,6 +88,11 @@ public:
     */
     void ActivateShell(SfxShell* pShell);
 
+    /** Activate the given shell, putting it at the bottom of the stack 
instead of
+        the top.
+     */
+    void ActivateLowPriorityShell(SfxShell* pShell);
+
     /** Deactivate the specified shell, i.e. take it and all of its
         object bars from the shell stack.
         @param pShell
diff --git a/sd/source/ui/view/ViewShellManager.cxx 
b/sd/source/ui/view/ViewShellManager.cxx
index 7f150b3d4f1c..a82a1be2dc82 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -108,8 +108,10 @@ public:
         ViewShell* pViewShell);
     void DeactivateViewShell (const ViewShell& rShell);
     void ActivateShell (SfxShell& rShell);
+    void ActivateLowPriorityShell (SfxShell& rShell);
     void DeactivateShell (const SfxShell& rShell);
     void ActivateShell (const ShellDescriptor& rDescriptor);
+    void ActivateLowPriorityShell (const ShellDescriptor& rDescriptor);
     void SetFormShell (const ViewShell* pViewShell, FmFormShell* pFormShell, 
bool bAbove);
     void ActivateSubShell (const SfxShell& rParentShell, ShellId nId);
     void DeactivateSubShell (const SfxShell& rParentShell, ShellId nId);
@@ -317,6 +319,12 @@ void ViewShellManager::ActivateShell (SfxShell* pShell)
         mpImpl->ActivateShell(*pShell);
 }
 
+void ViewShellManager::ActivateLowPriorityShell (SfxShell* pShell)
+{
+    if (mbValid && pShell!=nullptr)
+        mpImpl->ActivateLowPriorityShell(*pShell);
+}
+
 void ViewShellManager::DeactivateShell (const SfxShell* pShell)
 {
     if (mbValid && pShell!=nullptr)
@@ -498,6 +506,17 @@ void ViewShellManager::Implementation::ActivateShell 
(SfxShell& rShell)
     ActivateShell(aDescriptor);
 }
 
+void ViewShellManager::Implementation::ActivateLowPriorityShell (SfxShell& 
rShell)
+{
+    ::osl::MutexGuard aGuard (maMutex);
+
+    // Create a new shell or recycle on in the cache.
+    ShellDescriptor aDescriptor;
+    aDescriptor.mpShell = &rShell;
+
+    ActivateLowPriorityShell(aDescriptor);
+}
+
 void ViewShellManager::Implementation::ActivateShell (const ShellDescriptor& 
rDescriptor)
 {
     // Put shell on top of the active view shells.
@@ -507,6 +526,15 @@ void ViewShellManager::Implementation::ActivateShell 
(const ShellDescriptor& rDe
     }
 }
 
+void ViewShellManager::Implementation::ActivateLowPriorityShell (const 
ShellDescriptor& rDescriptor)
+{
+    // Put shell on bottom of the active view shells.
+    if (rDescriptor.mpShell != nullptr)
+    {
+        maActiveViewShells.push_back( rDescriptor );
+    }
+}
+
 void ViewShellManager::Implementation::DeactivateShell (const SfxShell& rShell)
 {
     ::osl::MutexGuard aGuard (maMutex);

Reply via email to