svx/inc/sdr/properties/itemsettools.hxx    |    8 ++++++--
 svx/source/sdr/properties/itemsettools.cxx |   10 ++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit f17489f80020dfd7a9de66c0d580dcf23f7d3c09
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Apr 13 09:26:12 2017 +0100

    ofz: fix leak
    
    this is still an ugly beast, but at least its new/delete on the same
    type now
    
    Change-Id: I7560eb30c2a43f2cf56a956144fbec66d7d163a6

diff --git a/svx/inc/sdr/properties/itemsettools.hxx 
b/svx/inc/sdr/properties/itemsettools.hxx
index cef08ef4907f..0e1f760e0777 100644
--- a/svx/inc/sdr/properties/itemsettools.hxx
+++ b/svx/inc/sdr/properties/itemsettools.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SVX_INC_SDR_PROPERTIES_ITEMSETTOOLS_HXX
 
 #include <sal/types.h>
+#include <vcl/region.hxx>
 
 class SdrObject;
 class SfxItemSet;
@@ -34,14 +35,17 @@ namespace sdr
     {
         class ItemChangeBroadcaster
         {
-            sal_uInt32                                      mnCount;
+            bool                                            mbSingleRect;
             void*                                           mpData;
 
         public:
             explicit ItemChangeBroadcaster(const SdrObject& rObj);
             ~ItemChangeBroadcaster();
 
-            sal_uInt32 GetRectangleCount() const {  return mnCount; }
+            sal_uInt32 GetRectangleCount() const
+            {
+                return mbSingleRect ? 1 : 
static_cast<RectangleVector*>(mpData)->size();
+            }
             const tools::Rectangle& GetRectangle(sal_uInt32 nIndex) const;
         };
     } // end of namespace properties
diff --git a/svx/source/sdr/properties/itemsettools.cxx 
b/svx/source/sdr/properties/itemsettools.cxx
index 942b5715ce68..b3cc64875edc 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -24,7 +24,6 @@
 #include <svl/whiter.hxx>
 #include <svx/svdogrp.hxx>
 #include <svx/svditer.hxx>
-#include <vcl/region.hxx>
 #include <vcl/outdev.hxx>
 #include <memory>
 
@@ -53,18 +52,18 @@ namespace sdr
                     }
                 }
 
-                mnCount = static_cast<RectangleVector*>(mpData)->size();
+                mbSingleRect = false;
             }
             else
             {
                 mpData = new tools::Rectangle(rObj.GetLastBoundRect());
-                mnCount = 1L;
+                mbSingleRect = true;
             }
         }
 
         ItemChangeBroadcaster::~ItemChangeBroadcaster()
         {
-            if(mnCount > 1)
+            if (!mbSingleRect)
             {
                 delete static_cast<RectangleVector*>(mpData);
             }
@@ -74,10 +73,9 @@ namespace sdr
             }
         }
 
-
         const tools::Rectangle& ItemChangeBroadcaster::GetRectangle(sal_uInt32 
nIndex) const
         {
-            if(mnCount > 1)
+            if (!mbSingleRect)
             {
                 return (*static_cast<RectangleVector*>(mpData))[nIndex];
             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to