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 /sc/source/ui/navipi/content.cxx | |
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 'sc/source/ui/navipi/content.cxx')
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 38 |
1 files changed, 19 insertions, 19 deletions
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<PopupMenu> aPop; + ScopedVclPtrInstance<ScPopupMenu> 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<ScPopupMenu> 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 ); } } |