diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-05-25 22:11:49 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-05-31 15:42:44 -0400 |
commit | 844d09c4cf6d08bb58e1b37a5ee7335320880654 (patch) | |
tree | 1b2f8e107dd622338192a142dee51f7fdbf22e47 | |
parent | fe2e9d59eae69378103650a642ffc02065b0027b (diff) |
Don't delete pCache too early; we need it alive to get the slot server.feature/calc-multiline-input
Let's use boost::scopted_ptr to avoid memory leak instead. The previous
code caused data input in Calc to fail for the first two times in
new document.
-rw-r--r-- | sfx2/source/control/bindings.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 931830f4c7..0b68d9f11e 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -72,6 +72,7 @@ #include <comphelper/uieventslogger.hxx> #include <com/sun/star/frame/XModuleManager.hpp> +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1144,14 +1145,14 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* rDispatcher.GetFrame(); // -Wall is this required??? // get SlotServer (Slot+ShellLevel) and Shell from cache - sal_Bool bDeleteCache = sal_False; + ::boost::scoped_ptr<SfxStateCache> xCache; if ( !pCache ) { // Execution of non cached slots (Accelerators don't use Controllers) // slot is uncached, use SlotCache to handle external dispatch providers - pCache = new SfxStateCache( nId ); + xCache.reset(new SfxStateCache(nId)); + pCache = xCache.get(); pCache->GetSlotServer( rDispatcher, pImp->xProv ); - bDeleteCache = sal_True; } if ( pCache && pCache->GetDispatch().is() ) @@ -1167,14 +1168,10 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* // cache binds to an external dispatch provider pCache->Dispatch( aReq.GetArgs(), nCallMode == SFX_CALLMODE_SYNCHRON ); - if ( bDeleteCache ) - DELETEZ( pCache ); SfxPoolItem *pVoid = new SfxVoidItem( nId ); DeleteItemOnIdle( pVoid ); return pVoid; } - else if ( pCache && bDeleteCache ) // just in case it was created, but GetDispatch() is 0 - DELETEZ( pCache ); // slot is handled internally by SfxDispatcher if ( pImp->bMsgDirty ) @@ -1224,9 +1221,6 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* pRet = pVoid; } - if ( bDeleteCache ) - delete pCache; - return pRet; } |