Kaydet (Commit) a0093404 authored tarafından Michael Stahl's avatar Michael Stahl

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 94d4764a)
üst 9bea733e
......@@ -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
{
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment