diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-20 15:56:35 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-23 06:28:00 +0000 |
commit | aa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 (patch) | |
tree | 8b2a5207e77fa4054a37b33c25378c23a00af8ed /toolkit | |
parent | b722f3d6fc72877e8caaaae7291d5d736ddc494d (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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<PopupMenu>::Create(); else - mpMenu = new MenuBar; + mpMenu = VclPtr<MenuBar>::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<PopupMenu*>(mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), + nRet = static_cast<PopupMenu*>(mpMenu.get())->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle( rPos ), static_cast<PopupMenuFlags>(nFlags) | PopupMenuFlags::NoMouseUpClose ); } @@ -726,7 +726,7 @@ throw (css::uno::RuntimeException, std::exception) ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) - static_cast<PopupMenu*>( mpMenu )->EndExecute(); + static_cast<PopupMenu*>( mpMenu.get() )->EndExecute(); } |