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 --- sc/source/ui/navipi/content.cxx | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'sc/source/ui/navipi/content.cxx') diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 7e7a04380575..1817750be525 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -579,16 +579,16 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) { // Drag-Drop Modus - PopupMenu aPop; - ScPopupMenu aDropMenu( ScResId( RID_POPUP_DROPMODE ) ); - aDropMenu.CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() ); - aPop.InsertItem( 1, pParentWindow->GetStrDragMode() ); - aPop.SetPopupMenu( 1, &aDropMenu ); + ScopedVclPtrInstance aPop; + ScopedVclPtrInstance aDropMenu( ScResId( RID_POPUP_DROPMODE ) ); + aDropMenu->CheckItem( RID_DROPMODE_URL + pParentWindow->GetDropMode() ); + aPop->InsertItem( 1, pParentWindow->GetStrDragMode() ); + aPop->SetPopupMenu( 1, aDropMenu.get() ); // angezeigtes Dokument - ScPopupMenu aDocMenu; - aDocMenu.SetMenuFlags( aDocMenu.GetMenuFlags() | MenuFlags::NoAutoMnemonics ); + ScopedVclPtrInstance aDocMenu; + aDocMenu->SetMenuFlags( aDocMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics ); sal_uInt16 i=0; sal_uInt16 nPos=0; // geladene Dokumente @@ -604,14 +604,14 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) aEntry += pParentWindow->aStrActive; else aEntry += pParentWindow->aStrNotActive; - aDocMenu.InsertItem( ++i, aEntry ); + aDocMenu->InsertItem( ++i, aEntry ); if ( !bHiddenDoc && aName == aManualDoc ) nPos = i; } pSh = SfxObjectShell::GetNext( *pSh ); } // "aktives Fenster" - aDocMenu.InsertItem( ++i, pParentWindow->aStrActiveWin ); + aDocMenu->InsertItem( ++i, pParentWindow->aStrActiveWin ); if (!bHiddenDoc && aManualDoc.isEmpty()) nPos = i; // verstecktes Dokument @@ -619,28 +619,28 @@ void ScContentTree::Command( const CommandEvent& rCEvt ) { OUString aEntry = aHiddenTitle; aEntry += pParentWindow->aStrHidden; - aDocMenu.InsertItem( ++i, aEntry ); + aDocMenu->InsertItem( ++i, aEntry ); if (bHiddenDoc) nPos = i; } - aDocMenu.CheckItem( nPos ); - aPop.InsertItem( 2, pParentWindow->GetStrDisplay() ); - aPop.SetPopupMenu( 2, &aDocMenu ); + aDocMenu->CheckItem( nPos ); + aPop->InsertItem( 2, pParentWindow->GetStrDisplay() ); + aPop->SetPopupMenu( 2, aDocMenu.get() ); // ausfuehren - aPop.Execute( this, rCEvt.GetMousePosPixel() ); + aPop->Execute( this, rCEvt.GetMousePosPixel() ); - if ( aDropMenu.WasHit() ) // Drag-Drop Modus + if ( aDropMenu->WasHit() ) // Drag-Drop Modus { - sal_uInt16 nId = aDropMenu.GetSelected(); + sal_uInt16 nId = aDropMenu->GetSelected(); if ( nId >= RID_DROPMODE_URL && nId <= RID_DROPMODE_COPY ) pParentWindow->SetDropMode( nId - RID_DROPMODE_URL ); } - else if ( aDocMenu.WasHit() ) // angezeigtes Dokument + else if ( aDocMenu->WasHit() ) // angezeigtes Dokument { - sal_uInt16 nId = aDocMenu.GetSelected(); - OUString aName = aDocMenu.GetItemText(nId); + sal_uInt16 nId = aDocMenu->GetSelected(); + OUString aName = aDocMenu->GetItemText(nId); SelectDoc( aName ); } } -- cgit v1.2.3