[Libreoffice-commits] core.git: include/svx svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 21 10:59:45 UTC 2018
include/svx/measctrl.hxx | 3 ++-
svx/source/dialog/measctrl.cxx | 13 +------------
2 files changed, 3 insertions(+), 13 deletions(-)
New commits:
commit 082b56282f60bca8f58e0c77161ea3afc2005f12
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 21 08:57:43 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 21 12:59:18 2018 +0200
coverity#1439599 Uninitialized pointer field
Change-Id: I083e9e01e26f294064104a4682c50a9bfc7fa09c
Reviewed-on: https://gerrit.libreoffice.org/60848
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx
index c3d2d4391769..db1380f6a34f 100644
--- a/include/svx/measctrl.hxx
+++ b/include/svx/measctrl.hxx
@@ -21,6 +21,7 @@
#include <vcl/customweld.hxx>
#include <svx/svxdllapi.h>
+#include <svx/svdobj.hxx>
#include <memory>
class SfxItemSet;
@@ -33,7 +34,7 @@ class SVX_DLLPUBLIC SvxXMeasurePreview : public weld::CustomWidgetController
private:
MapMode m_aMapMode;
- SdrMeasureObj* pMeasureObj;
+ std::unique_ptr<SdrMeasureObj, SdrObjectFreeOp> pMeasureObj;
std::unique_ptr<SdrModel> pModel;
void ResizeImpl(const Size& rSize);
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index 87c0c3f38d6c..1e641d6b5d42 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -41,7 +41,7 @@ void SvxXMeasurePreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
pModel.reset(new SdrModel(nullptr, nullptr, true));
- pMeasureObj = new SdrMeasureObj(*pModel, Point(), Point());
+ pMeasureObj.reset(new SdrMeasureObj(*pModel, Point(), Point()));
ResizeImpl(aSize);
Invalidate();
@@ -72,17 +72,6 @@ void SvxXMeasurePreview::Resize()
SvxXMeasurePreview::~SvxXMeasurePreview()
{
- // No one is deleting the MeasureObj? This is not only an error but also
- // a memory leak (!). Main problem is that this object is still listening to
- // a StyleSheet of the model which was set. Thus, if You want to keep the object,
- // set the model to 0L, if object is not needed (seems to be the case here),
- // delete it.
-
- // always use SdrObject::Free(...) for SdrObjects (!)
- SdrObject* pTemp(pMeasureObj);
- SdrObject::Free(pTemp);
-
- pModel.reset();
}
void SvxXMeasurePreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
More information about the Libreoffice-commits
mailing list