summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-27 12:52:16 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-27 12:48:50 +0000
commite25669fcedcb7231254d3ba0e0224b2e3eb901d8 (patch)
tree05ce242744c88d9efcd5b685720b2178008c2c8c /toolkit
parent96d03636a5f932151c7842ae34631258891fe807 (diff)
don't allocate uno::Reference on the heap
There is no point, since it's the size of a pointer anyway (found by temporarily making the new operator in uno::Reference deleted). Change-Id: I62a8b957fef9184f65d705600acfdab4116dcb34 Reviewed-on: https://gerrit.libreoffice.org/19603 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxmenu.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index b1b809e6e899..4c6c20adb897 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -52,9 +52,7 @@ VCLXMenu::VCLXMenu( Menu* pMenu )
VCLXMenu::~VCLXMenu()
{
- for ( size_t n = maPopupMenuRefs.size(); n; ) {
- delete maPopupMenuRefs[ --n ];
- }
+ maPopupMenuRefs.clear();
if ( mpMenu )
{
mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
@@ -425,10 +423,7 @@ throw(css::uno::RuntimeException, std::exception)
if ( mpMenu && pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() )
{
- // Selbst eine Ref halten!
- css::uno::Reference< css::awt::XPopupMenu > * pNewRef = new css::uno::Reference< css::awt::XPopupMenu > ;
- *pNewRef = rxPopupMenu;
- maPopupMenuRefs.push_back( pNewRef );
+ maPopupMenuRefs.push_back( rxPopupMenu );
mpMenu->SetPopupMenu( nItemId, static_cast<PopupMenu*>( pVCLMenu->GetMenu() ) );
}
@@ -447,11 +442,11 @@ throw(css::uno::RuntimeException, std::exception)
{
for ( size_t n = maPopupMenuRefs.size(); n; )
{
- css::uno::Reference< css::awt::XPopupMenu > * pRef = maPopupMenuRefs[ --n ];
- Menu* pM = static_cast<VCLXMenu*>(pRef->get())->GetMenu();
+ css::uno::Reference< css::awt::XPopupMenu >& rRef = maPopupMenuRefs[ --n ];
+ Menu* pM = static_cast<VCLXMenu*>(rRef.get())->GetMenu();
if ( pM == pMenu )
{
- aRef = *pRef;
+ aRef = rRef;
break;
}
}