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 --- svx/source/fmcomp/gridctrl.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'svx/source/fmcomp/gridctrl.cxx') diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index cb6b42a07a3a..e2992ee288a8 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -2827,11 +2827,11 @@ void DbGridControl::copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId) void DbGridControl::executeRowContextMenu( long _nRow, const Point& _rPreferredPos ) { - PopupMenu aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) ); + ScopedVclPtrInstance aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) ); - PreExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu ); - aContextMenu.RemoveDisabledEntries( true, true ); - PostExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu, aContextMenu.Execute( this, _rPreferredPos ) ); + PreExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get() ); + aContextMenu->RemoveDisabledEntries( true, true ); + PostExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get(), aContextMenu->Execute( this, _rPreferredPos ) ); // TODO: why this weird cast to sal_uInt16? What if we really have more than 65535 lines? // -> change this to sal_uInt32 @@ -2872,9 +2872,9 @@ void DbGridControl::Command(const CommandEvent& rEvt) } else if (canCopyCellText(nRow, nColId)) { - PopupMenu aContextMenu(SVX_RES(RID_SVXMNU_CELL)); - aContextMenu.RemoveDisabledEntries(true, true); - switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel())) + ScopedVclPtrInstance aContextMenu(SVX_RES(RID_SVXMNU_CELL)); + aContextMenu->RemoveDisabledEntries(true, true); + switch (aContextMenu->Execute(this, rEvt.GetMousePosPixel())) { case SID_COPY: copyCellText(nRow, nColId); -- cgit