[Libreoffice-commits] .: sfx2/source
Michael Stahl
mst at kemper.freedesktop.org
Mon Jan 23 09:42:17 PST 2012
sfx2/source/inc/virtmenu.hxx | 8 +++++---
sfx2/source/menu/virtmenu.cxx | 20 +++++++++++++-------
2 files changed, 18 insertions(+), 10 deletions(-)
New commits:
commit a0093404ffbca79655a52019d6bf66b976964fe9
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jan 23 18:38:45 2012 +0100
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)
diff --git a/sfx2/source/inc/virtmenu.hxx b/sfx2/source/inc/virtmenu.hxx
index 998fe66..44bf381 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 c62dfd5..0098ee5 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();
More information about the Libreoffice-commits
mailing list