summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:34:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 10:59:59 +0200
commiteceecde6ccc69004898cf657bc75a140c388614f (patch)
tree79b3064fc63a846e56f3fc7f7e5d931af4bf7e9c /avmedia
parent1d9ea5f576cab03c920a6be933a923b7bcdabc44 (diff)
use rtl::Reference in MediaWindowImpl
instead of storing both a raw pointer and an uno::Reference Change-Id: Id42d43e14b573d48310b9e353667da80d171110e
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx23
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx3
2 files changed, 13 insertions, 13 deletions
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 5566251e9f48..25cd07f03f51 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -129,7 +129,6 @@ MediaWindowImpl::MediaWindowImpl(vcl::Window* pParent, MediaWindow* pMediaWindow
, DropTargetHelper(this)
, DragSourceHelper(this)
, mpMediaWindow(pMediaWindow)
- , mpEvents(nullptr)
, mbEventTransparent(true)
, mpMediaWindowControl(bInternalMediaControl ? VclPtr<MediaWindowControl>::Create(this) : nullptr)
, mpEmptyBmpEx(nullptr)
@@ -149,14 +148,15 @@ MediaWindowImpl::~MediaWindowImpl()
void MediaWindowImpl::dispose()
{
- if (mpEvents)
- mpEvents->cleanUp();
+ if (mxEvents.is())
+ mxEvents->cleanUp();
if (mxPlayerWindow.is())
{
- mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
- mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
- mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
+ auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
+ mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
+ mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) );
+ mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) );
uno::Reference< lang::XComponent > xComponent( mxPlayerWindow, uno::UNO_QUERY );
if (xComponent.is())
@@ -455,7 +455,7 @@ void MediaWindowImpl::onURLChanged()
if (!mpChildWindow)
return;
mpChildWindow->SetHelpId(HID_AVMEDIA_PLAYERWINDOW);
- mxEventsIf.set(static_cast<cppu::OWeakObject*>(mpEvents = new MediaEventListenersImpl(*mpChildWindow.get())));
+ mxEvents = new MediaEventListenersImpl(*mpChildWindow.get());
if (mxPlayer.is())
{
@@ -482,10 +482,11 @@ void MediaWindowImpl::onURLChanged()
if( xPlayerWindow.is() )
{
- xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
- xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
- xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
- xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( mxEventsIf, uno::UNO_QUERY ) );
+ auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
+ xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
+ xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) );
+ xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) );
+ xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( pEventsIf, uno::UNO_QUERY ) );
}
}
else
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 649a99874302..c179a9e55110 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -147,8 +147,7 @@ private:
css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
MediaWindow* mpMediaWindow;
- css::uno::Reference<css::uno::XInterface> mxEventsIf;
- MediaEventListenersImpl* mpEvents;
+ rtl::Reference<MediaEventListenersImpl> mxEvents;
bool mbEventTransparent;
VclPtr<MediaChildWindow> mpChildWindow;
VclPtr<MediaWindowControl> mpMediaWindowControl;