diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-23 15:34:14 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-23 22:08:25 +0200 |
commit | 4ec3554a80f065c2d9c957d6ce7f577fb195be02 (patch) | |
tree | 53eb10bf31d595cb46616f0ad56cfe7efd7b1ff0 /avmedia | |
parent | dd1f8ac3575a929e71b39d5f7043be057ebaa727 (diff) |
avmedia: avoid segmentation fault during destruction of media window
mpEvents is not initialized in the destructor any more:
b5529c8c457f442bfc43305becc0c02d6a09ee80
Plus use scoped_ptr to stop memory leak.
Change-Id: Idaaa274e39c1ac34270ae5b0acdd237ee5aec1c3
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.cxx | 6 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow_impl.hxx | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 6ebe2f70f56e..8660a8288a55 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -178,7 +178,8 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo MediaWindowImpl::~MediaWindowImpl() { - mpEvents->cleanUp(); + if( mpEvents ) + mpEvents->cleanUp(); if( mxPlayerWindow.is() ) { @@ -515,7 +516,8 @@ void MediaWindowImpl::onURLChanged() if( !mpChildWindow ) return; mpChildWindow->SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); - mxEventsIf.set( static_cast< ::cppu::OWeakObject* >( mpEvents = new MediaEventListenersImpl( *mpChildWindow.get() ) ) ); + mpEvents.reset(new MediaEventListenersImpl( *mpChildWindow.get() ) ); + mxEventsIf.set( static_cast< ::cppu::OWeakObject* >( mpEvents.get() ) ); if( mxPlayer.is() ) { diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index c1ba15c52cc1..2fcafc59e01b 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -173,7 +173,7 @@ namespace avmedia MediaWindow* mpMediaWindow; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxEventsIf; - MediaEventListenersImpl* mpEvents; + boost::scoped_ptr<MediaEventListenersImpl> mpEvents; bool mbEventTransparent; boost::scoped_ptr<MediaChildWindow> mpChildWindow; MediaWindowControl* mpMediaWindowControl; |