Kaydet (Commit) 3d07d18a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use an osl::Mutex directly

Change-Id: I49b88214bca33add9f9ea3d81870d54e40c5255b
üst 3f1d1539
......@@ -18,7 +18,6 @@
*/
#include <dispatch/windowcommanddispatch.hxx>
#include <threadhelp/guard.hxx>
#include <targets.h>
#include <services.h>
......@@ -40,8 +39,7 @@ namespace framework{
WindowCommandDispatch::WindowCommandDispatch(const css::uno::Reference< css::uno::XComponentContext >& xContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame)
: ThreadHelpBase( )
, m_xContext (xContext )
: m_xContext (xContext )
, m_xFrame (xFrame )
, m_xWindow (xFrame->getContainerWindow())
{
......@@ -58,9 +56,9 @@ WindowCommandDispatch::~WindowCommandDispatch()
void WindowCommandDispatch::impl_startListening()
{
Guard aReadLock(m_aLock);
osl::ClearableMutexGuard aReadLock(m_mutex);
css::uno::Reference< css::awt::XWindow > xWindow( m_xWindow.get(), css::uno::UNO_QUERY );
aReadLock.unlock();
aReadLock.clear();
if ( ! xWindow.is())
return;
......@@ -78,9 +76,9 @@ void WindowCommandDispatch::impl_startListening()
void WindowCommandDispatch::impl_stopListening()
{
Guard aReadLock(m_aLock);
osl::ClearableMutexGuard aReadLock(m_mutex);
css::uno::Reference< css::awt::XWindow > xWindow( m_xWindow.get(), css::uno::UNO_QUERY );
aReadLock.unlock();
aReadLock.clear();
if (!xWindow.is())
return;
......@@ -152,10 +150,10 @@ void WindowCommandDispatch::impl_dispatchCommand(const OUString& sCommand)
try
{
// SYNCHRONIZED ->
Guard aReadLock(m_aLock);
osl::ClearableMutexGuard aReadLock(m_mutex);
css::uno::Reference< css::frame::XDispatchProvider > xProvider(m_xFrame.get(), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext;
aReadLock.unlock();
aReadLock.clear();
// <- SYNCHRONIZED
// check provider ... we know it's weak reference only
......
......@@ -20,8 +20,6 @@
#ifndef INCLUDED_FRAMEWORK_SOURCE_INC_DISPATCH_WINDOWCOMMANDDISPATCH_HXX
#define INCLUDED_FRAMEWORK_SOURCE_INC_DISPATCH_WINDOWCOMMANDDISPATCH_HXX
#include <threadhelp/threadhelpbase.hxx>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
......@@ -47,9 +45,10 @@ namespace framework{
scenarios. On the other side VCL does not hold us alive (because it doesn't know our UNO reference).
So we register at the VCL level as an event listener and
*/
class WindowCommandDispatch : private ThreadHelpBase
class WindowCommandDispatch
{
private:
osl::Mutex m_mutex;
/// can be used to create own needed services on demand.
css::uno::Reference< css::uno::XComponentContext > m_xContext;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment