sd/source/ui/inc/View.hxx      |    6 +++++-
 sd/source/ui/view/drviews1.cxx |    2 +-
 sd/source/ui/view/sdview.cxx   |    2 +-
 sd/source/ui/view/sdview2.cxx  |   29 ++++++++++++++++++++---------
 4 files changed, 27 insertions(+), 12 deletions(-)

New commits:
commit 2907f7d97a3dabe1179f0251791fcee336b26a22
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jun 1 11:40:11 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jun 1 15:27:20 2021 +0200

    cid#1485150 Uncaught exception
    
    remove the reported exception path from the dtor call
    
    Change-Id: I438a9c3de41d516e1994aeb1509bb8ee333bf23f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116532
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 68c09f547409..693e596d1084 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -131,7 +131,11 @@ public:
     css::uno::Reference<css::datatransfer::XTransferable>
         CreateSelectionDataObject (::sd::View*);
 
-    void                    UpdateSelectionClipboard( bool bForceDeselect );
+    // update clipboard to what is selected
+    void UpdateSelectionClipboard();
+
+    // release content of clipboard, if we own the content
+    void ClearSelectionClipboard();
 
     DrawDocShell* GetDocSh() const { return mpDocSh; }
     inline SdDrawDocument& GetDoc() const;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index be985ede217a..6c1df14a3961 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -249,7 +249,7 @@ void DrawViewShell::SelectionHasChanged()
     // Invalidate for every subshell
     GetViewShellBase().GetViewShellManager()->InvalidateAllSubShells(this);
 
-    mpDrawView->UpdateSelectionClipboard( false );
+    mpDrawView->UpdateSelectionClipboard();
 
     GetViewShellBase().GetDrawController().FireSelectionChangeListener();
 }
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 32f9feac8d35..e2e0a053a47e 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -135,7 +135,7 @@ View::~View()
     maSmartTags.Dispose();
 
     // release content of selection clipboard, if we own the content
-    UpdateSelectionClipboard( true );
+    ClearSelectionClipboard();
 
     maDropErrorIdle.Stop();
     maDropInsertFileIdle.Stop();
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 69790987b299..ba1b2cc226d7 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -211,17 +211,28 @@ css::uno::Reference< css::datatransfer::XTransferable > 
View::CreateSelectionDat
     return pTransferable;
 }
 
-void View::UpdateSelectionClipboard( bool bForceDeselect )
+void View::UpdateSelectionClipboard() // false case
 {
-    if( mpViewSh && mpViewSh->GetActiveWindow() )
+    if (!mpViewSh)
+        return;
+    if (!mpViewSh->GetActiveWindow())
+        return;
+    if (GetMarkedObjectList().GetMarkCount())
+        CreateSelectionDataObject( this );
+    else
+        ClearSelectionClipboard();
+}
+
+void View::ClearSelectionClipboard() // true case
+{
+    if (!mpViewSh)
+        return;
+    if (!mpViewSh->GetActiveWindow())
+        return;
+    if (SD_MOD()->pTransferSelection && 
SD_MOD()->pTransferSelection->GetView() == this)
     {
-        if( !bForceDeselect && GetMarkedObjectList().GetMarkCount() )
-            CreateSelectionDataObject( this );
-        else if( SD_MOD()->pTransferSelection && ( 
SD_MOD()->pTransferSelection->GetView() == this ) )
-        {
-            TransferableHelper::ClearPrimarySelection();
-            SD_MOD()->pTransferSelection = nullptr;
-        }
+        TransferableHelper::ClearPrimarySelection();
+        SD_MOD()->pTransferSelection = nullptr;
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to