From 1385896fe760fe61b19a682cb7dc7fdf31d31490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 5 Feb 2013 09:53:24 +0000 Subject: [PATCH] Resolves: fdo#60144 only delete *unposted* SfxRequests accumulated during lock When the dispatched is locked, SfxRequests accumulate in aReqArr for later dispatch when unlocked via Post The pointers are typically deleted in Post, so only if we never get around to posting them do we delete the unposted requests. regression from 528aba3a9cf91da5ce70c6d631d7b82e203f8086 Change-Id: I4c214791d356ce0e5401a87b968b53e4866f6174 --- sfx2/source/control/dispatch.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 975b834331e3..6ec85ea1a55a 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -60,12 +60,12 @@ #include #include -#include +#include DBG_NAME(SfxDispatcherFlush) DBG_NAME(SfxDispatcherFillState) -typedef boost::ptr_vector SfxRequestPtrArray; +typedef std::vector SfxRequestPtrArray; DECL_PTRSTACK(SfxShellStack_Impl, SfxShell*, 8, 4 ); @@ -110,7 +110,17 @@ struct SfxObjectBars_Impl struct SfxDispatcher_Impl { - SfxRequestPtrArray aReqArr; + //When the dispatched is locked, SfxRequests accumulate in aReqArr for + //later dispatch when unlocked via Post + // + //The pointers are typically deleted in Post, only if we never get around + //to posting them do we delete the unposted requests. + SfxRequestPtrArray aReqArr; + ~SfxDispatcher_Impl() + { + for (SfxRequestPtrArray::iterator aI = aReqArr.begin(), aEnd = aReqArr.end(); aI != aEnd; ++aI) + delete *aI; + } const SfxSlotServer* pCachedServ1; // last called message const SfxSlotServer* pCachedServ2; // penultimate called Message SfxShellStack_Impl aStack; // active functionality @@ -2149,7 +2159,7 @@ void SfxDispatcher::Lock( sal_Bool bLock ) if ( !bLock ) { for(size_t i = 0; i < pImp->aReqArr.size(); ++i) - pImp->xPoster->Post(&pImp->aReqArr[i]); + pImp->xPoster->Post(pImp->aReqArr[i]); pImp->aReqArr.clear(); } }