summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2001-11-15 15:02:10 +0000
committerTino Rachui <tra@openoffice.org>2001-11-15 15:02:10 +0000
commit070aae5ec1beb6f271ab860aad5f4fc87f8895b8 (patch)
tree1e5cbdf4f0efdc442a0d7cbbbda8cac409cfc1a5 /fpicker
parente4ebdad8c48272b7ec7738a90d4edafe4cfea8bd (diff)
#94499#using an asynchronous event notifier in order to prevent deadlocks
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.cxx53
-rw-r--r--fpicker/source/win32/filepicker/FilePicker.hxx20
2 files changed, 27 insertions, 46 deletions
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index f5d529d0b2ad..ef2354f18d59 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -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 );
}
}
diff --git a/fpicker/source/win32/filepicker/FilePicker.hxx b/fpicker/source/win32/filepicker/FilePicker.hxx
index 761c904f02a4..5653e01ae89d 100644
--- a/fpicker/source/win32/filepicker/FilePicker.hxx
+++ b/fpicker/source/win32/filepicker/FilePicker.hxx
@@ -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