summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-13 09:26:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-13 10:28:00 +0100
commitf17489f80020dfd7a9de66c0d580dcf23f7d3c09 (patch)
tree1e02138d914507e5fc84b8883e5ffcb510063404
parent291ec5e9708352a1d98c54814dad8db7ce38fdb9 (diff)
ofz: fix leak
this is still an ugly beast, but at least its new/delete on the same type now Change-Id: I7560eb30c2a43f2cf56a956144fbec66d7d163a6
-rw-r--r--svx/inc/sdr/properties/itemsettools.hxx8
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx10
2 files changed, 10 insertions, 8 deletions
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];
}