[Libreoffice-commits] core.git: include/svtools svtools/source
Noel Grandin
noel.grandin at collabora.co.uk
Sun Apr 29 15:05:02 UTC 2018
include/svtools/editbrowsebox.hxx | 5 ++---
svtools/source/brwbox/editbrowsebox.cxx | 10 +++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
New commits:
commit 22077670edcec437a3505ae412c06c974f273b7b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Apr 24 14:51:04 2018 +0200
loplugin:useuniqueptr in BrowserMouseEventPtr
Change-Id: Idbde5b63fc1241bef0a9237727fa1b010ce1eef9
Reviewed-on: https://gerrit.libreoffice.org/53599
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 5d76e28e46f6..2c66a3cb612e 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -452,7 +452,7 @@ namespace svt
class BrowserMouseEventPtr
{
- BrowserMouseEvent* pEvent;
+ std::unique_ptr<BrowserMouseEvent> pEvent;
bool bDown;
public:
@@ -461,11 +461,10 @@ namespace svt
, bDown(false)
{
}
- ~BrowserMouseEventPtr(){Clear();}
bool Is() const {return pEvent != nullptr;}
bool IsDown() const {return bDown;}
- const BrowserMouseEvent* operator->() const {return pEvent;}
+ const BrowserMouseEvent* operator->() const {return pEvent.get();}
SVT_DLLPUBLIC void Clear();
void Set(const BrowserMouseEvent* pEvt, bool bIsDown);
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 41d824fddbbe..1a9cb86b80aa 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -82,25 +82,25 @@ namespace svt
void EditBrowseBox::BrowserMouseEventPtr::Clear()
{
- DELETEZ(pEvent);
+ pEvent.reset();
}
void EditBrowseBox::BrowserMouseEventPtr::Set(const BrowserMouseEvent* pEvt, bool bIsDown)
{
- if (pEvt == pEvent)
+ if (pEvt == pEvent.get())
{
bDown = bIsDown;
return;
}
- Clear();
+ pEvent.reset();
if (pEvt)
{
- pEvent = new BrowserMouseEvent(pEvt->GetWindow(),
+ pEvent.reset(new BrowserMouseEvent(pEvt->GetWindow(),
*pEvt,
pEvt->GetRow(),
pEvt->GetColumn(),
pEvt->GetColumnId(),
- pEvt->GetRect());
+ pEvt->GetRect()));
bDown = bIsDown;
}
}
More information about the Libreoffice-commits
mailing list