summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-10-27 22:31:47 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-10-27 22:11:07 +0000
commit89c23b4aaef931b5d6009efaf44ce6e6c976e8d4 (patch)
tree73cb7691235d8c723ba5bc8add032daac0a6d53b /sw
parentcoverity#1374310 Uncaught exception (diff)
downloadcore-89c23b4aaef931b5d6009efaf44ce6e6c976e8d4.tar.gz
core-89c23b4aaef931b5d6009efaf44ce6e6c976e8d4.zip
Sub menus no longer need manual disposing
after: commit ee79a2dd7ea60e902cab3a9203e307b8a78fee23 Author: Caolán McNamara <caolanm@redhat.com> Date: Fri Jul 29 14:33:22 2016 +0100 Resolves: tdf#101169 crash using column menu in base Change-Id: I7c6e54dd5574c61cffd5884d1cf1b63075073001 Reviewed-on: https://gerrit.libreoffice.org/30343 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/inc/workctrl.hxx3
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx20
2 files changed, 2 insertions, 21 deletions
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx
index 3133b696652d..ba259bf46db1 100644
--- a/sw/source/uibase/inc/workctrl.hxx
+++ b/sw/source/uibase/inc/workctrl.hxx
@@ -53,9 +53,6 @@ class SwView;
class SwTbxAutoTextCtrl : public SfxToolBoxControl
{
- VclPtr<PopupMenu> pPopup;
-
- void DelPopup();
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 32eb4c5af748..8007a5010358 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -67,26 +67,24 @@ SwTbxAutoTextCtrl::SwTbxAutoTextCtrl(
sal_uInt16 nSlotId,
sal_uInt16 nId,
ToolBox& rTbx ) :
- SfxToolBoxControl( nSlotId, nId, rTbx ),
- pPopup(nullptr)
+ SfxToolBoxControl( nSlotId, nId, rTbx )
{
rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
}
SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
{
- DelPopup();
}
VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
{
+ ScopedVclPtrInstance<PopupMenu> pPopup;
SwView* pView = ::GetActiveView();
if(pView && !pView->GetDocShell()->IsReadOnly() &&
!pView->GetWrtShell().HasReadonlySel() )
{
Link<Menu*,bool> aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl);
- pPopup = VclPtr<PopupMenu>::Create();
SwGlossaryList* pGlossaryList = ::GetGlossaryList();
const size_t nGroupCount = pGlossaryList->GetGroupCount();
for(size_t i = 1; i <= nGroupCount; ++i)
@@ -123,9 +121,7 @@ VclPtr<SfxPopupWindow> SwTbxAutoTextCtrl::CreatePopupWindow()
pToolBox->SetItemDown( nId, false );
}
GetToolBox().EndSelection();
- DelPopup();
return nullptr;
-
}
void SwTbxAutoTextCtrl::StateChanged( sal_uInt16,
@@ -158,18 +154,6 @@ IMPL_STATIC_LINK(SwTbxAutoTextCtrl, PopupHdl, Menu*, pMenu, bool)
return false;
}
-void SwTbxAutoTextCtrl::DelPopup()
-{
- if(pPopup)
- {
- for( sal_uInt16 i = 0; i < pPopup->GetItemCount(); i ++ )
- {
- pPopup->DisposePopupMenu(pPopup->GetItemId(i));
- }
- pPopup.disposeAndClear();
- }
-}
-
// Navigation-Popup
// determine the order of the toolbox items
static sal_uInt16 aNavigationInsertIds[ NAVI_ENTRIES ] =