vcl::EventPoster shall probably be covered by SolarMutex
...as most parts of VCL. Ran across at least one case where a remote call to framework::CloseDispatcher::release -> ~CloseDispatcher -> ~EventPoster -> Application::RemoveUserEvent caused a crash. As always with SolarMutex, keep fingers crossed that this is about the right level to acquire it. Change-Id: I8f4be7329adbf72355774fa5d3c472270da3ddd2
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/frame/DispatchResultState.hpp>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <cppuhelper/implbase2.hxx>
|
||||
#include <vcl/evntpost.hxx>
|
||||
|
||||
@@ -88,7 +89,7 @@ class CloseDispatcher : public ::cppu::WeakImplHelper2<
|
||||
/** @short used for asynchronous callbacks within the main thread.
|
||||
@descr Internally we work asynchronous. Because our callis
|
||||
are not aware, that her request can kill its own environment ... */
|
||||
::vcl::EventPoster m_aAsyncCallback;
|
||||
boost::scoped_ptr<vcl::EventPoster> m_aAsyncCallback;
|
||||
|
||||
/** @short used inside asyncronous callback to decide,
|
||||
which operation must be executed. */
|
||||
|
@@ -57,7 +57,8 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
|
||||
const css::uno::Reference< css::frame::XFrame >& xFrame ,
|
||||
const OUString& sTarget)
|
||||
: m_xContext (rxContext )
|
||||
, m_aAsyncCallback (LINK( this, CloseDispatcher, impl_asyncCallback))
|
||||
, m_aAsyncCallback(
|
||||
new vcl::EventPoster(LINK(this, CloseDispatcher, impl_asyncCallback)))
|
||||
, m_eOperation(E_CLOSE_DOC)
|
||||
, m_lStatusListener(m_mutex)
|
||||
, m_pSysWindow(NULL)
|
||||
@@ -77,6 +78,8 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
|
||||
|
||||
CloseDispatcher::~CloseDispatcher()
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
m_aAsyncCallback.reset();
|
||||
}
|
||||
|
||||
void SAL_CALL CloseDispatcher::dispatch(const css::util::URL& aURL ,
|
||||
@@ -215,7 +218,10 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL&
|
||||
if ( bIsSynchron )
|
||||
impl_asyncCallback(0);
|
||||
else
|
||||
m_aAsyncCallback.Post(0);
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
m_aAsyncCallback->Post(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,6 +17,9 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <tools/debug.hxx>
|
||||
#include <vcl/evntpost.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
@@ -31,6 +34,7 @@ EventPoster::EventPoster( const Link& rLink )
|
||||
|
||||
EventPoster::~EventPoster()
|
||||
{
|
||||
DBG_TESTSOLARMUTEX();
|
||||
if ( m_nId )
|
||||
GetpApp()->RemoveUserEvent( m_nId );
|
||||
}
|
||||
@@ -38,11 +42,13 @@ EventPoster::~EventPoster()
|
||||
void EventPoster::Post( UserEvent* pEvent )
|
||||
|
||||
{
|
||||
DBG_TESTSOLARMUTEX();
|
||||
m_nId = GetpApp()->PostUserEvent( ( LINK( this, EventPoster, DoEvent_Impl ) ), pEvent );
|
||||
}
|
||||
|
||||
IMPL_LINK( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
|
||||
{
|
||||
DBG_TESTSOLARMUTEX();
|
||||
m_nId = 0;
|
||||
m_aLink.Call( pEvent );
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user