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 /starmath | |
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 'starmath')
-rw-r--r-- | starmath/source/edit.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index ba9fda42b4c9..bf1af9a64ae3 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -340,10 +340,10 @@ void SmEditWindow::Command(const CommandEvent& rCEvt) GetParent()->ToTop(); Point aPoint = rCEvt.GetMousePosPixel(); - std::unique_ptr<PopupMenu> xPopupMenu(new PopupMenu(SmResId(RID_COMMANDMENU))); + VclPtr<PopupMenu> xPopupMenu = VclPtr<PopupMenu>::Create(SmResId(RID_COMMANDMENU)); // added for replaceability of context menus - Menu* pMenu = nullptr; + VclPtr<Menu> pMenu; css::ui::ContextMenuExecuteEvent aEvent; aEvent.SourceWindow = VCLUnoHelper::GetInterface( this ); aEvent.ExecutePosition.X = aPoint.X(); @@ -353,7 +353,8 @@ void SmEditWindow::Command(const CommandEvent& rCEvt) { if ( pMenu ) { - xPopupMenu.reset(static_cast<PopupMenu*>(pMenu)); + xPopupMenu.disposeAndClear(); + xPopupMenu = static_cast<PopupMenu*>(pMenu.get()); } } |