#94499#using an asynchronous event notifier in order to prevent deadlocks
This commit is contained in:
parent
e4ebdad8c4
commit
070aae5ec1
2 changed files with 27 additions and 46 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: FilePicker.cxx,v $
|
||||
*
|
||||
* $Revision: 1.9 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
* last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $
|
||||
* last change: $Author: tra $ $Date: 2001-11-15 16:02:10 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -150,7 +150,8 @@ CFilePicker::CFilePicker( const Reference< XMultiServiceFactory >& xServiceMgr )
|
|||
XInitialization,
|
||||
XCancellable,
|
||||
XEventListener,
|
||||
XServiceInfo >( m_rbHelperMtx )
|
||||
XServiceInfo >( m_rbHelperMtx ),
|
||||
m_aAsyncEventNotifier( rBHelper )
|
||||
{
|
||||
HINSTANCE hInstance = GetModuleHandleA( FILE_PICKER_DLL_NAME );
|
||||
OSL_POSTCOND( hInstance, "The name of the service dll must have changed" );
|
||||
|
@ -212,9 +213,9 @@ void SAL_CALL CFilePicker::disposing( const EventObject& aEvent ) throw(RuntimeE
|
|||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CFilePicker::fileSelectionChanged( FilePickerEvent aEvent ) const
|
||||
void SAL_CALL CFilePicker::fileSelectionChanged( FilePickerEvent aEvent )
|
||||
{
|
||||
PFNCXFPLISTENER pfncFPListener = &XFilePickerListener::fileSelectionChanged;
|
||||
CAsyncFilePickerEventNotifier::FilePickerEventListenerMethod_t pfncFPListener = &XFilePickerListener::fileSelectionChanged;
|
||||
aEvent.Source = Reference< XInterface > (
|
||||
static_cast< XFilePickerNotifier* >(
|
||||
const_cast< CFilePicker* >( this ) ) );
|
||||
|
@ -225,9 +226,9 @@ void SAL_CALL CFilePicker::fileSelectionChanged( FilePickerEvent aEvent ) const
|
|||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CFilePicker::directoryChanged( FilePickerEvent aEvent ) const
|
||||
void SAL_CALL CFilePicker::directoryChanged( FilePickerEvent aEvent )
|
||||
{
|
||||
PFNCXFPLISTENER pfncFPListener = &XFilePickerListener::directoryChanged;
|
||||
CAsyncFilePickerEventNotifier::FilePickerEventListenerMethod_t pfncFPListener = &XFilePickerListener::directoryChanged;
|
||||
aEvent.Source = Reference< XInterface > (
|
||||
static_cast< XFilePickerNotifier* >(
|
||||
const_cast< CFilePicker* >( this ) ) );
|
||||
|
@ -294,9 +295,9 @@ OUString SAL_CALL CFilePicker::helpRequested( FilePickerEvent aEvent ) const
|
|||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CFilePicker::controlStateChanged( FilePickerEvent aEvent ) const
|
||||
void SAL_CALL CFilePicker::controlStateChanged( FilePickerEvent aEvent )
|
||||
{
|
||||
PFNCXFPLISTENER pfncFPListener = &XFilePickerListener::controlStateChanged;
|
||||
CAsyncFilePickerEventNotifier::FilePickerEventListenerMethod_t pfncFPListener = &XFilePickerListener::controlStateChanged;
|
||||
aEvent.Source = Reference< XInterface > (
|
||||
static_cast< XFilePickerNotifier* >(
|
||||
const_cast< CFilePicker* >( this ) ) );
|
||||
|
@ -307,7 +308,7 @@ void SAL_CALL CFilePicker::controlStateChanged( FilePickerEvent aEvent ) const
|
|||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CFilePicker::dialogSizeChanged( ) const
|
||||
void SAL_CALL CFilePicker::dialogSizeChanged( )
|
||||
{
|
||||
// not yet implemented
|
||||
}
|
||||
|
@ -316,40 +317,16 @@ void SAL_CALL CFilePicker::dialogSizeChanged( ) const
|
|||
//
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CFilePicker::notifyAllListener( PFNCXFPLISTENER pfncFPListener, FilePickerEvent aEvent ) const
|
||||
void SAL_CALL CFilePicker::notifyAllListener( CAsyncFilePickerEventNotifier::FilePickerEventListenerMethod_t pfncFPListener, FilePickerEvent aEvent )
|
||||
{
|
||||
OSL_ASSERT( 0 != pfncFPListener );
|
||||
OSL_ASSERT( pfncFPListener );
|
||||
|
||||
if ( !rBHelper.bDisposed )
|
||||
{
|
||||
::osl::ClearableMutexGuard aGuard( rBHelper.rMutex );
|
||||
::osl::MutexGuard aGuard( rBHelper.rMutex );
|
||||
|
||||
if ( !rBHelper.bDisposed )
|
||||
{
|
||||
aGuard.clear( );
|
||||
|
||||
::cppu::OInterfaceContainerHelper* pICHelper =
|
||||
rBHelper.aLC.getContainer( getCppuType( ( Reference< XFilePickerListener > * ) 0 ) );
|
||||
|
||||
if ( pICHelper )
|
||||
{
|
||||
::cppu::OInterfaceIteratorHelper iter( *pICHelper );
|
||||
|
||||
while( iter.hasMoreElements( ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
Reference< XFilePickerListener > xFPListener( iter.next( ), ::com::sun::star::uno::UNO_QUERY );
|
||||
if ( xFPListener.is( ) )
|
||||
(xFPListener.get( )->*pfncFPListener)(aEvent);
|
||||
}
|
||||
catch( RuntimeException& )
|
||||
{
|
||||
OSL_ENSURE( false, "RuntimeException during event dispatching" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_aAsyncEventNotifier.notifyEvent( pfncFPListener, aEvent );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: FilePicker.hxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: tra $ $Date: 2001-10-16 14:03:12 $
|
||||
* last change: $Author: tra $ $Date: 2001-11-15 16:02:10 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -111,6 +111,10 @@
|
|||
#include "WinFileOpenImpl.hxx"
|
||||
#endif
|
||||
|
||||
#ifndef _ASYNCEVENTNOTIFIER_HXX_
|
||||
#include "asynceventnotifier.hxx"
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
//----------------------------------------------------------
|
||||
|
@ -285,15 +289,14 @@ public:
|
|||
// FilePicker Event functions
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
|
||||
void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
|
||||
void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
|
||||
void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
|
||||
rtl::OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
|
||||
void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
|
||||
void SAL_CALL dialogSizeChanged( ) const;
|
||||
void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
|
||||
void SAL_CALL dialogSizeChanged( );
|
||||
|
||||
private:
|
||||
typedef void (SAL_CALL ::com::sun::star::ui::dialogs::XFilePickerListener::*PFNCXFPLISTENER)(const ::com::sun::star::ui::dialogs::FilePickerEvent&);
|
||||
void SAL_CALL notifyAllListener( PFNCXFPLISTENER pfncFPListener, ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
|
||||
void SAL_CALL notifyAllListener( CAsyncFilePickerEventNotifier::FilePickerEventListenerMethod_t pfncFPListener, ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
|
||||
|
||||
private:
|
||||
// prevent copy and assignment
|
||||
|
@ -303,6 +306,7 @@ private:
|
|||
private:
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr; // to instanciate own services
|
||||
std::auto_ptr< CWinFileOpenImpl > m_pImpl;
|
||||
CAsyncFilePickerEventNotifier m_aAsyncEventNotifier;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue