summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-20 15:56:35 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-23 06:28:00 +0000
commitaa0d0536a444fb26d9e570bd6bf6c1bdc3596cf3 (patch)
tree8b2a5207e77fa4054a37b33c25378c23a00af8ed /cui
parentb722f3d6fc72877e8caaaae7291d5d736ddc494d (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 'cui')
-rw-r--r--cui/source/customize/cfg.cxx5
-rw-r--r--cui/source/tabpages/numpages.cxx5
-rw-r--r--cui/source/tabpages/tpline.cxx12
3 files changed, 13 insertions, 9 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index f3e1b62d62d5..1b08c29ebeea 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3134,7 +3134,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
m_pMoveDownButton->Enable();
m_pMoveUpButton->Enable();
- PopupMenu* pMenu = new PopupMenu( CUI_RES( MODIFY_TOOLBAR ) );
+ VclPtrInstance<PopupMenu> pMenu( CUI_RES( MODIFY_TOOLBAR ) );
pMenu->SetMenuFlags(
pMenu->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
@@ -3142,8 +3142,7 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
m_pModifyTopLevelButton->SetSelectHdl(
LINK( this, SvxToolbarConfigPage, ToolbarSelectHdl ) );
- PopupMenu* pEntry = new PopupMenu(
- CUI_RES( MODIFY_TOOLBAR_CONTENT ) );
+ VclPtrInstance<PopupMenu> pEntry( CUI_RES( MODIFY_TOOLBAR_CONTENT ) );
pEntry->SetMenuFlags(
pEntry->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 5c5eed24ab99..4eafff907164 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1239,7 +1239,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent,
pBitmapMenu->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
m_nGalleryId = pBitmapMenu->GetItemId("gallery");
assert(m_nGalleryId != MENU_ITEM_NOTFOUND);
- PopupMenu* pPopup = new PopupMenu;
+ VclPtrInstance<PopupMenu> pPopup;
pBitmapMenu->SetPopupMenu(m_nGalleryId, pPopup);
eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
@@ -1258,7 +1258,8 @@ void SvxNumOptionsTabPage::dispose()
{
if (m_pBitmapMB)
{
- delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
+ VclPtr<PopupMenu> p = m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
+ p.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
}
delete pActNum;
pActNum = nullptr;
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 4c12af016a0e..ca323ab469ea 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -229,10 +229,14 @@ void SvxLineTabPage::dispose()
// Symbols on a line (e.g. StarCharts), dtor new!
if (m_pSymbolMB)
{
- delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+ VclPtr<PopupMenu> p = m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_GALLERY );
+ p.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
if(m_pSymbolList)
- delete m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
+ {
+ VclPtr<PopupMenu> p2 = m_pSymbolMB->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
+ p2.disposeAndClear(); // NoelG: dodgy, this leaves a dangling pointer
+ }
m_pSymbolMB = nullptr;
}
@@ -290,7 +294,7 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
// Get gallery entries
GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, m_aGrfNames);
- PopupMenu* pPopup = new PopupMenu;
+ VclPtrInstance<PopupMenu> pPopup;
sal_uInt32 i = 0;
m_nNumMenuGalleryItems = m_aGrfNames.size();
for(std::vector<OUString>::iterator it = m_aGrfNames.begin(); it != m_aGrfNames.end(); ++it, ++i)
@@ -363,7 +367,7 @@ void SvxLineTabPage::InitSymbols(MenuButton* pButton)
pView->hideMarkHandles();
pView->ShowSdrPage(pPage);
- PopupMenu* pPopup = new PopupMenu;
+ VclPtrInstance<PopupMenu> pPopup;
// Generate invisible square to give all symbols a
// bitmap size, which is independent from specific glyph