sd/source/ui/view/ViewShellManager.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c1473de894b17f113fcb6c81f82592434e272a8c
Author:     Sarper Akdemir <sarper.akde...@allotropia.de>
AuthorDate: Thu Dec 12 10:55:50 2024 +0100
Commit:     Sarper Akdemir <sarper.akde...@allotropia.de>
CommitDate: Thu Dec 12 11:52:04 2024 +0100

    sd: keep a non-owning pointer to the OverridingShell
    
    ... instead of keeping an owning shared_ptr
    
    To fix the ubsan build error
    <https://ci.libreoffice.org/job/lo_ubsan/3385/>
    
    Which appears to be caused from EventMultiplexer::CallListeners
    triggering a NotesPanelView to be deleted, and then notifying
    that just-deleted NotesPanelView, see
    
<https://gerrit.libreoffice.org/c/core/+/177686/2#message-857c0180ae3e6572534d3bcd40f32000d434cc3d>
    
    Change-Id: I05e67dfeab093e7549e9b2ec4caf4a95dc743627
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178348
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Reviewed-by: Sarper Akdemir <sarper.akde...@allotropia.de>

diff --git a/sd/source/ui/view/ViewShellManager.cxx 
b/sd/source/ui/view/ViewShellManager.cxx
index a82a1be2dc82..0e6076efb1ce 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -117,7 +117,7 @@ public:
     void DeactivateSubShell (const SfxShell& rParentShell, ShellId nId);
     void RemoveOverridingMainShell();
     void SetOverridingShell(const std::shared_ptr<ViewShell>& pViewShell);
-    const std::shared_ptr<ViewShell> & GetOverridingShell();
+    std::shared_ptr<ViewShell> GetOverridingShell();
     void MoveToTop (const SfxShell& rParentShell);
     SfxShell* GetShell (ShellId nId) const;
     SfxShell* GetTopShell() const;
@@ -194,7 +194,7 @@ private:
     SfxShell* mpTopShell;
     SfxShell* mpTopViewShell;
 
-    std::shared_ptr<ViewShell> mpOverridingShell;
+    std::weak_ptr<ViewShell> mpOverridingShell;
 
     void UpdateShellStack();
 
@@ -626,9 +626,9 @@ void ViewShellManager::Implementation::DeactivateSubShell (
     DestroySubShell(aDescriptor);
 }
 
-const std::shared_ptr<ViewShell> & 
ViewShellManager::Implementation::GetOverridingShell()
+std::shared_ptr<ViewShell> 
ViewShellManager::Implementation::GetOverridingShell()
 {
-    return mpOverridingShell;
+    return mpOverridingShell.lock();
 }
 
 void ViewShellManager::Implementation::RemoveOverridingMainShell()

Reply via email to