sd/source/ui/annotations/annotationmanager.cxx |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit 3d3af64f315203d36940d82f54a39e51aff8c8b3
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Tue Jan 7 12:12:52 2025 +0900
Commit:     Ilmari Lauhakangas <[email protected]>
CommitDate: Tue Jan 7 12:09:35 2025 +0100

    tdf#162246 use main ViewShell when synching the annotations
    
    Current ViewShell is not always available, but we use the main
    ViewShell most of the time anyway in AnnotationManager, so use
    that when annotation synching. Use only the current ViewShell
    when opening the annotation pop-up window.
    
    Change-Id: Ibbc8e0859d0b91617577148e76e8293cb8015941
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179849
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179871
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sd/source/ui/annotations/annotationmanager.cxx 
b/sd/source/ui/annotations/annotationmanager.cxx
index ec876c667aaa..6fbb13637a72 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -983,17 +983,12 @@ void AnnotationManagerImpl::SyncAnnotationObjects()
     if (!mxCurrentPage.is() || !mpDoc)
         return;
 
-    sd::DrawDocShell* pDocShell = 
dynamic_cast<sd::DrawDocShell*>(SfxObjectShell::Current());
-    sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : 
nullptr;
+    std::shared_ptr<DrawViewShell> pDrawViewShell = 
std::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell());
 
-    if (!pViewShell)
-    {
-        pViewShell = mrBase.GetMainViewShell().get();
-        if (!pViewShell)
-            return;
-    }
+    if (!pDrawViewShell)
+        return;
 
-    auto* pView = pViewShell->GetView();
+    auto* pView = pDrawViewShell->GetView();
     if (!pView)
         return;
 

Reply via email to