diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-08 11:45:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-08 13:04:44 +0100 |
commit | 8cd21316bafbcf70f4c5cef3a173e639e9bdcd66 (patch) | |
tree | a18f818a3d5cf90328dc31898993b5256341f8de /framework/source/loadenv | |
parent | 4daff1ace2931012901a994d1b4dbff3eaea6e00 (diff) |
complete and utter nonsense
Taking the address of the pCheck argument in LoadEnvListener ctor gives the
address of the temporary on the stack/register itself, not the address of
LoadEnv's m_pCheck which is apparently what it thinks it's doing.
All that can be said about m_ppCheck is deferencing it inside the ctor will
give the value of pCheck for the duration of the ctor. What happens later on
in subsequent method calls is pot luck, storing it and deferencing it later is
meaningless.
Presumably this worked because it's rare for the dereferenced m_ppCheck to end
up containing 0 at the wrong time. Right now in a debugging build the mail
merge dialog from print... when there are form fields in a document and "print
form field" is selected triggers a 0 in there post construction at some stage
or other, causing the dialog to never appear as the loading here never
completes.
Diffstat (limited to 'framework/source/loadenv')
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 784f6f765d27..a746211da472 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -117,17 +117,16 @@ class LoadEnvListener : private ThreadHelpBase { private: - void** m_ppCheck ; + bool m_bWaitingResult; LoadEnv* m_pLoadEnv; public: //_______________________________________ - LoadEnvListener(void* pCheck , - LoadEnv* pLoadEnv) + LoadEnvListener(LoadEnv* pLoadEnv) + : m_bWaitingResult(true) + , m_pLoadEnv(pLoadEnv) { - m_ppCheck = &pCheck ; - m_pLoadEnv = pLoadEnv; } //_______________________________________ @@ -154,7 +153,6 @@ LoadEnv::LoadEnv(const css::uno::Reference< css::lang::XMultiServiceFactory >& x throw(LoadEnvException, css::uno::RuntimeException) : ThreadHelpBase( ) , m_xSMGR (xSMGR) - , m_pCheck (this ) , m_pQuietInteraction( 0 ) { } @@ -162,7 +160,6 @@ LoadEnv::LoadEnv(const css::uno::Reference< css::lang::XMultiServiceFactory >& x LoadEnv::~LoadEnv() { - m_pCheck = 0; } @@ -537,9 +534,9 @@ void SAL_CALL LoadEnvListener::loadFinished(const css::uno::Reference< css::fram // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - if (m_ppCheck && *m_ppCheck) + if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_True); - m_ppCheck = NULL; + m_bWaitingResult = false; aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -552,9 +549,9 @@ void SAL_CALL LoadEnvListener::loadCancelled(const css::uno::Reference< css::fra // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - if (m_ppCheck && *m_ppCheck) + if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_False); - m_ppCheck = NULL; + m_bWaitingResult = false; aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -567,7 +564,7 @@ void SAL_CALL LoadEnvListener::dispatchFinished(const css::frame::DispatchResult // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - if (!m_ppCheck || !*m_ppCheck) + if (!m_bWaitingResult) return; switch(aEvent.State) @@ -584,7 +581,7 @@ void SAL_CALL LoadEnvListener::dispatchFinished(const css::frame::DispatchResult m_pLoadEnv->impl_setResult(sal_False); break; } - m_ppCheck = NULL; + m_bWaitingResult = false; aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -597,9 +594,9 @@ void SAL_CALL LoadEnvListener::disposing(const css::lang::EventObject&) // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - if (m_ppCheck && *m_ppCheck) + if (m_bWaitingResult) m_pLoadEnv->impl_setResult(sal_False); - m_ppCheck = NULL; + m_bWaitingResult = false; aWriteLock.unlock(); // <- SAFE ---------------------------------- @@ -928,8 +925,7 @@ sal_Bool LoadEnv::impl_handleContent() // SAFE -> ----------------------------------- WriteGuard aWriteLock(m_aLock); m_xAsynchronousJob = xHandler; - m_pCheck = this; - LoadEnvListener* pListener = new LoadEnvListener(m_pCheck, this); + LoadEnvListener* pListener = new LoadEnvListener(this); aWriteLock.unlock(); // <- SAFE ----------------------------------- @@ -1136,8 +1132,7 @@ sal_Bool LoadEnv::impl_loadContent() // SAFE -> ----------------------------------- aWriteLock.lock(); m_xAsynchronousJob = xAsyncLoader; - m_pCheck = this; - LoadEnvListener* pListener = new LoadEnvListener(m_pCheck, this); + LoadEnvListener* pListener = new LoadEnvListener(this); aWriteLock.unlock(); // <- SAFE ----------------------------------- |