diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 09:34:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-18 10:59:59 +0200 |
commit | eceecde6ccc69004898cf657bc75a140c388614f (patch) | |
tree | 79b3064fc63a846e56f3fc7f7e5d931af4bf7e9c /avmedia/source/viewer/mediawindow_impl.cxx | |
parent | 1d9ea5f576cab03c920a6be933a923b7bcdabc44 (diff) |
use rtl::Reference in MediaWindowImpl
instead of storing both a raw pointer and an uno::Reference
Change-Id: Id42d43e14b573d48310b9e353667da80d171110e
Diffstat (limited to 'avmedia/source/viewer/mediawindow_impl.cxx')
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.cxx | 23 |
1 files changed, 12 insertions, 11 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 |