From aa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 20 Jun 2016 15:56:35 +0200 Subject: tdf#97527 - vcl: reference-count Menu some places are marked with "dodgy"- need to check those to see what is going on, because they are leaving dangling pointers behind in the Menu class Change-Id: I41d5c7c0fec2f70ce9e3ffdc48cd03d26c0a869b Reviewed-on: https://gerrit.libreoffice.org/26516 Tested-by: Jenkins Reviewed-by: Noel Grandin --- toolkit/source/awt/vclxmenu.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 8c2598e9f982..827e0df4756d 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -56,7 +56,7 @@ VCLXMenu::~VCLXMenu() if ( mpMenu ) { mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) ); - delete mpMenu; + mpMenu.disposeAndClear(); } } @@ -70,9 +70,9 @@ void VCLXMenu::ImplCreateMenu( bool bPopup ) DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" ); if ( bPopup ) - mpMenu = new PopupMenu; + mpMenu = VclPtr::Create(); else - mpMenu = new MenuBar; + mpMenu = VclPtr::Create(); mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) ); } @@ -526,7 +526,7 @@ throw(css::uno::RuntimeException, std::exception) sal_Int16 nRet = 0; if ( mpMenu && IsPopupMenu() ) { - nRet = static_cast(mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), + nRet = static_cast(mpMenu.get())->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle( rPos ), static_cast(nFlags) | PopupMenuFlags::NoMouseUpClose ); } @@ -726,7 +726,7 @@ throw (css::uno::RuntimeException, std::exception) ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) - static_cast( mpMenu )->EndExecute(); + static_cast( mpMenu.get() )->EndExecute(); } -- cgit