diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-27 22:31:47 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-10-27 22:11:07 +0000 |
commit | 89c23b4aaef931b5d6009efaf44ce6e6c976e8d4 (patch) | |
tree | 73cb7691235d8c723ba5bc8add032daac0a6d53b /sw | |
parent | 798c107a1afa6e22a0de97c49d0bda552913e56a (diff) |
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.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 20 |
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 ] = |