[Libreoffice-commits] core.git: 2 commits - sdext/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 21 09:49:03 UTC 2020


 sdext/source/pdfimport/inc/genericelements.hxx |    7 +++----
 sdext/source/presenter/PresenterScrollBar.cxx  |    5 ++---
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 419afcf902056ab0863093e5a00d91eef43a4c6b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 21 10:24:12 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 21 11:48:33 2020 +0200

    return shared_ptr from createDocumentElement
    
    which is what the only callsite wants
    
    Change-Id: Ica83e7de89ec56c9b4f742f3da19d295a3250a9d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92610
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx b/sdext/source/pdfimport/inc/genericelements.hxx
index d29540036f07..ff0ba6f52d84 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -270,9 +270,8 @@ namespace pdfi
     struct DocumentElement : public Element
     {
         friend class ElementFactory;
-    protected:
-        DocumentElement() : Element( nullptr ) {}
     public:
+        DocumentElement() : Element( nullptr ) {}
         virtual ~DocumentElement() override;
 
         virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
@@ -307,8 +306,8 @@ namespace pdfi
         static PageElement* createPageElement( Element* pParent,
                                                 sal_Int32 nPageNr )
         { return new PageElement( pParent, nPageNr ); }
-        static DocumentElement* createDocumentElement()
-        { return new DocumentElement(); }
+        static std::shared_ptr<DocumentElement> createDocumentElement()
+        { return std::make_shared<DocumentElement>(); }
     };
 }
 
commit eab3a2ffe1618e2beec820300abef1843c079bae
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 21 10:22:12 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 21 11:48:17 2020 +0200

    use weak_ptr properly
    
    just call lock() instead of manually calling expired()
    
    Change-Id: If76826fb62092b00fce25c53cf6be89b72d40c4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92609
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    Tested-by: Jenkins

diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx
index 58a34d0f73f7..46f1490e38f3 100644
--- a/sdext/source/presenter/PresenterScrollBar.cxx
+++ b/sdext/source/presenter/PresenterScrollBar.cxx
@@ -241,7 +241,8 @@ void PresenterScrollBar::SetCanvas (const Reference<css::rendering::XCanvas>& rx
 
     if (mpBitmaps == nullptr)
     {
-        if (mpSharedBitmaps.expired())
+        mpBitmaps = mpSharedBitmaps.lock();
+        if (!mpBitmaps)
         {
             try
             {
@@ -257,8 +258,6 @@ void PresenterScrollBar::SetCanvas (const Reference<css::rendering::XCanvas>& rx
                 OSL_ASSERT(false);
             }
         }
-        else
-            mpBitmaps = std::shared_ptr<PresenterBitmapContainer>(mpSharedBitmaps);
         UpdateBitmaps();
         UpdateBorders();
     }


More information about the Libreoffice-commits mailing list