use rtl::Reference in MediaWindowImpl
instead of storing both a raw pointer and an uno::Reference Change-Id: Id42d43e14b573d48310b9e353667da80d171110e
This commit is contained in:
parent
1d9ea5f576
commit
eceecde6cc
@ -129,7 +129,6 @@ MediaWindowImpl::MediaWindowImpl(vcl::Window* pParent, MediaWindow* pMediaWindow
|
|||||||
, DropTargetHelper(this)
|
, DropTargetHelper(this)
|
||||||
, DragSourceHelper(this)
|
, DragSourceHelper(this)
|
||||||
, mpMediaWindow(pMediaWindow)
|
, mpMediaWindow(pMediaWindow)
|
||||||
, mpEvents(nullptr)
|
|
||||||
, mbEventTransparent(true)
|
, mbEventTransparent(true)
|
||||||
, mpMediaWindowControl(bInternalMediaControl ? VclPtr<MediaWindowControl>::Create(this) : nullptr)
|
, mpMediaWindowControl(bInternalMediaControl ? VclPtr<MediaWindowControl>::Create(this) : nullptr)
|
||||||
, mpEmptyBmpEx(nullptr)
|
, mpEmptyBmpEx(nullptr)
|
||||||
@ -149,14 +148,15 @@ MediaWindowImpl::~MediaWindowImpl()
|
|||||||
|
|
||||||
void MediaWindowImpl::dispose()
|
void MediaWindowImpl::dispose()
|
||||||
{
|
{
|
||||||
if (mpEvents)
|
if (mxEvents.is())
|
||||||
mpEvents->cleanUp();
|
mxEvents->cleanUp();
|
||||||
|
|
||||||
if (mxPlayerWindow.is())
|
if (mxPlayerWindow.is())
|
||||||
{
|
{
|
||||||
mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
|
auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
|
||||||
mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
|
mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
|
||||||
mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, 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 );
|
uno::Reference< lang::XComponent > xComponent( mxPlayerWindow, uno::UNO_QUERY );
|
||||||
if (xComponent.is())
|
if (xComponent.is())
|
||||||
@ -455,7 +455,7 @@ void MediaWindowImpl::onURLChanged()
|
|||||||
if (!mpChildWindow)
|
if (!mpChildWindow)
|
||||||
return;
|
return;
|
||||||
mpChildWindow->SetHelpId(HID_AVMEDIA_PLAYERWINDOW);
|
mpChildWindow->SetHelpId(HID_AVMEDIA_PLAYERWINDOW);
|
||||||
mxEventsIf.set(static_cast<cppu::OWeakObject*>(mpEvents = new MediaEventListenersImpl(*mpChildWindow.get())));
|
mxEvents = new MediaEventListenersImpl(*mpChildWindow.get());
|
||||||
|
|
||||||
if (mxPlayer.is())
|
if (mxPlayer.is())
|
||||||
{
|
{
|
||||||
@ -482,10 +482,11 @@ void MediaWindowImpl::onURLChanged()
|
|||||||
|
|
||||||
if( xPlayerWindow.is() )
|
if( xPlayerWindow.is() )
|
||||||
{
|
{
|
||||||
xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
|
auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get());
|
||||||
xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
|
xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) );
|
||||||
xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
|
xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) );
|
||||||
xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( mxEventsIf, uno::UNO_QUERY ) );
|
xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) );
|
||||||
|
xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( pEventsIf, uno::UNO_QUERY ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -147,8 +147,7 @@ private:
|
|||||||
css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
|
css::uno::Reference<css::media::XPlayerWindow> mxPlayerWindow;
|
||||||
MediaWindow* mpMediaWindow;
|
MediaWindow* mpMediaWindow;
|
||||||
|
|
||||||
css::uno::Reference<css::uno::XInterface> mxEventsIf;
|
rtl::Reference<MediaEventListenersImpl> mxEvents;
|
||||||
MediaEventListenersImpl* mpEvents;
|
|
||||||
bool mbEventTransparent;
|
bool mbEventTransparent;
|
||||||
VclPtr<MediaChildWindow> mpChildWindow;
|
VclPtr<MediaChildWindow> mpChildWindow;
|
||||||
VclPtr<MediaWindowControl> mpMediaWindowControl;
|
VclPtr<MediaWindowControl> mpMediaWindowControl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user