summaryrefslogtreecommitdiff
path: root/svx/source/fmcomp/fmgridcl.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-08 18:57:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-12-09 07:16:34 +0000
commit4754afddc3030347ef49b401a9b798cea8fe523c (patch)
treea7505da2dae9b8eae70ed463309521c11780d4c4 /svx/source/fmcomp/fmgridcl.cxx
parent6fd3f3caad1a559165dc9332249cbd0d84930775 (diff)
Use unique_ptr out-arg to in SfxBindings::QueryState to avoid mem leaks
Change-Id: I35df02de675068478a36ef05266ffc2d3054b07f Reviewed-on: https://gerrit.libreoffice.org/20477 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx/source/fmcomp/fmgridcl.cxx')
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 2de79055f8af..2e5c50ce9006 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -761,15 +761,14 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
// ask the bindings of the current view frame (which should be the one we're residing in) for the state
if (pCurrentFrame)
{
- SfxPoolItem* pItem = nullptr;
+ std::unique_ptr<SfxPoolItem> pItem;
eState = pCurrentFrame->GetBindings().QueryState(SID_FM_CTL_PROPERTIES, pItem);
- if (eState >= SfxItemState::DEFAULT && pItem )
+ if (eState >= SfxItemState::DEFAULT && pItem.get() != nullptr )
{
- bool bChecked = dynamic_cast<const SfxBoolItem*>( pItem) != nullptr && static_cast<SfxBoolItem*>(pItem)->GetValue();
+ bool bChecked = dynamic_cast<const SfxBoolItem*>( pItem.get()) != nullptr && static_cast<SfxBoolItem*>(pItem.get())->GetValue();
rMenu.CheckItem(SID_FM_SHOW_PROPERTY_BROWSER,bChecked);
}
- delete pItem;
}
}
}