diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-01-23 18:38:45 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-01-23 18:40:34 +0100 |
commit | a0093404ffbca79655a52019d6bf66b976964fe9 (patch) | |
tree | c8e6d7de6658a7f6e8f0a890c5b6605f1463e300 /sfx2 | |
parent | 9bea733ecf01da09aaf7281868441b8a02fcf5cc (diff) |
SfxVirtualMenu: fix context menu crash:
SfxMenuCtrlArr_Impl used to be a PTRARR_DEL, so use a boost::ptr_vector
to ensure elements are deleted.
(regression from 94d4764a42f8f38b884bb8960791d80ac876b786)
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/inc/virtmenu.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/menu/virtmenu.cxx | 20 |
2 files changed, 18 insertions, 10 deletions
diff --git a/sfx2/source/inc/virtmenu.hxx b/sfx2/source/inc/virtmenu.hxx index 998fe66ce7b6..44bf381589a2 100644 --- a/sfx2/source/inc/virtmenu.hxx +++ b/sfx2/source/inc/virtmenu.hxx @@ -25,8 +25,10 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SFXVIRTMENU_HXX -#define _SFXVIRTMENU_HXX +#ifndef SFXVIRTMENU_HXX +#define SFXVIRTMENU_HXX + +#include <boost/ptr_container/ptr_vector.hpp> #include <sfx2/mnuitem.hxx> #include "mnucfga.hxx" @@ -35,7 +37,7 @@ class SfxBindings; class Timer; class SfxMenuImageControl_Impl; -typedef std::vector<SfxMenuControl*> SfxMenuCtrlArr_Impl; +typedef ::boost::ptr_vector<SfxMenuControl> SfxMenuCtrlArr_Impl; class SAL_DLLPUBLIC_EXPORT SfxVirtualMenu { diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index c62dfd570013..0098ee534d4c 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -731,11 +731,14 @@ void SfxVirtualMenu::BindControllers() } SfxMenuCtrlArr_Impl& rCtrlArr = GetAppCtrl_Impl(); - for(SfxMenuCtrlArr_Impl::const_iterator i = rCtrlArr.begin(); i != rCtrlArr.end(); ++i) + for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); + i != rCtrlArr.end(); ++i) { - sal_uInt16 nSlotId = (*i)->GetId(); + sal_uInt16 nSlotId = i->GetId(); if ( !pSVMenu->GetItemCommand(nSlotId).Len() ) - (*i)->ReBind(); + { + i->ReBind(); + } } pBindings->LEAVEREGISTRATIONS(); @@ -755,11 +758,14 @@ void SfxVirtualMenu::UnbindControllers() } SfxMenuCtrlArr_Impl& rCtrlArr = GetAppCtrl_Impl(); - for(SfxMenuCtrlArr_Impl::const_iterator i = rCtrlArr.begin(); i != rCtrlArr.end(); ++i) + for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); + i != rCtrlArr.end(); ++i) { - if((*i)->IsBound()) - // UnoController is not binded! - (*i)->UnBind(); + if (i->IsBound()) + { + // UnoController is not bound! + i->UnBind(); + } } pBindings->LEAVEREGISTRATIONS(); |