diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-08 14:22:44 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-08 18:27:11 +0100 |
commit | 80af51be1aa85733b9c0b696a93edd8c6520811c (patch) | |
tree | 378acc64e86ba525a924d519a414f5d331a9f9cb | |
parent | 560ee8d10201ee6cdac21e9400d60bcc5f064bb5 (diff) |
ODBFilter::filter: Also leave window wait on exception
Change-Id: I6bb759c583e15f229bc2afa178a1d1d90d8315ef
Reviewed-on: https://gerrit.libreoffice.org/44458
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | dbaccess/source/filter/xml/xmlfilter.cxx | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 8069a577f8e1..f386206bec66 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -244,30 +244,38 @@ css::uno::Reference< css::uno::XInterface > return static_cast< XServiceInfo* >(new ODBFilter( comphelper::getComponentContext(_rxORB))); } - -sal_Bool SAL_CALL ODBFilter::filter( const Sequence< PropertyValue >& rDescriptor ) +namespace { +class FocusWindowWaitGuard { - uno::Reference< css::awt::XWindow > xWindow; +public: + FocusWindowWaitGuard() { SolarMutexGuard aGuard; - vcl::Window* pFocusWindow = Application::GetFocusWindow(); - xWindow = VCLUnoHelper::GetInterface( pFocusWindow ); - if( pFocusWindow ) - pFocusWindow->EnterWait(); + mpWindow.set(Application::GetFocusWindow()); + if (mpWindow) + mpWindow->EnterWait(); } + ~FocusWindowWaitGuard() + { + if (mpWindow) + { + SolarMutexGuard aGuard; + mpWindow->LeaveWait(); + } + } +private: + VclPtr<vcl::Window> mpWindow; +}; +} + +sal_Bool SAL_CALL ODBFilter::filter( const Sequence< PropertyValue >& rDescriptor ) +{ + FocusWindowWaitGuard aWindowFocusGuard; bool bRet = false; if ( GetModel().is() ) bRet = implImport( rDescriptor ); - if ( xWindow.is() ) - { - SolarMutexGuard aGuard; - VclPtr<vcl::Window> pFocusWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pFocusWindow ) - pFocusWindow->LeaveWait(); - } - return bRet; } |