Kaydet (Commit) 5a617461 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Meeks

tdf#91960 presentation causes Impress crash

The SystenChildWindow in question is owned by ViewMediaShape
Fixed ViewMediaShape to dispose the vcl objects it creates correctly.
Also fix another crash in MediaWindowImpl child window correctly disposing its children.

Change-Id: If4aebcb6e5824266c154416f7246d73c6cb3509c
Reviewed-on: https://gerrit.libreoffice.org/16230Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 1666b1b7
...@@ -51,7 +51,10 @@ MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) : ...@@ -51,7 +51,10 @@ MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) :
MediaWindow::~MediaWindow() {} MediaWindow::~MediaWindow()
{
mpImpl.disposeAndClear();
}
......
...@@ -148,8 +148,8 @@ namespace slideshow ...@@ -148,8 +148,8 @@ namespace slideshow
mxPlayerWindow.clear(); mxPlayerWindow.clear();
} }
mpMediaWindow.reset(); mpMediaWindow.disposeAndClear();
mpEventHandlerParent.reset(); mpEventHandlerParent.disposeAndClear();
// shutdown player // shutdown player
if( mxPlayer.is() ) if( mxPlayer.is() )
...@@ -471,20 +471,23 @@ namespace slideshow ...@@ -471,20 +471,23 @@ namespace slideshow
#else #else
if( avmedia::IsModel(rMimeType) ) if( avmedia::IsModel(rMimeType) )
{ {
mpEventHandlerParent.reset(VclPtr<vcl::Window>::Create(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL)); mpMediaWindow.disposeAndClear();
mpEventHandlerParent.disposeAndClear();
mpEventHandlerParent = VclPtr<vcl::Window>::Create(pWindow, WB_NOBORDER|WB_NODIALOGCONTROL);
mpEventHandlerParent->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), mpEventHandlerParent->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) ); Size( aAWTRect.Width, aAWTRect.Height ) );
mpEventHandlerParent->EnablePaint(false); mpEventHandlerParent->EnablePaint(false);
mpEventHandlerParent->Show(); mpEventHandlerParent->Show();
SystemWindowData aWinData = OpenGLContext::generateWinData(mpEventHandlerParent.get(), false); SystemWindowData aWinData = OpenGLContext::generateWinData(mpEventHandlerParent.get(), false);
mpMediaWindow.reset(VclPtr<SystemChildWindow>::Create(mpEventHandlerParent.get(), 0, &aWinData)); mpMediaWindow = VclPtr<SystemChildWindow>::Create(mpEventHandlerParent.get(), 0, &aWinData);
mpMediaWindow->SetPosSizePixel( Point( 0, 0 ), mpMediaWindow->SetPosSizePixel( Point( 0, 0 ),
Size( aAWTRect.Width, aAWTRect.Height ) ); Size( aAWTRect.Width, aAWTRect.Height ) );
} }
else else
#endif #endif
{ {
mpMediaWindow.reset( VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN ) ); mpMediaWindow.disposeAndClear();
mpMediaWindow = VclPtr<SystemChildWindow>::Create( pWindow, WB_CLIPCHILDREN );
mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) ); Size( aAWTRect.Width, aAWTRect.Height ) );
} }
...@@ -503,7 +506,6 @@ namespace slideshow ...@@ -503,7 +506,6 @@ namespace slideshow
aAWTRect.X = aAWTRect.Y = 0; aAWTRect.X = aAWTRect.Y = 0;
aArgs[ 1 ] = uno::makeAny( aAWTRect ); aArgs[ 1 ] = uno::makeAny( aAWTRect );
aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() ) ); aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() ) );
mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) ); mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) );
...@@ -519,8 +521,8 @@ namespace slideshow ...@@ -519,8 +521,8 @@ namespace slideshow
{ {
//if there was no playerwindow, then clear the mpMediaWindow too //if there was no playerwindow, then clear the mpMediaWindow too
//so that we can draw a placeholder instead in that space //so that we can draw a placeholder instead in that space
mpMediaWindow.reset(); mpMediaWindow.disposeAndClear();
mpEventHandlerParent.reset(); mpEventHandlerParent.disposeAndClear();
} }
} }
} }
......
...@@ -148,8 +148,8 @@ namespace slideshow ...@@ -148,8 +148,8 @@ namespace slideshow
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams,
const OUString& rMimeType ); const OUString& rMimeType );
ViewLayerSharedPtr mpViewLayer; ViewLayerSharedPtr mpViewLayer;
VclPtr< SystemChildWindow > mpMediaWindow; VclPtr< SystemChildWindow > mpMediaWindow;
VclPtr< vcl::Window > mpEventHandlerParent; VclPtr< vcl::Window > mpEventHandlerParent;
mutable ::com::sun::star::awt::Point maWindowOffset; mutable ::com::sun::star::awt::Point maWindowOffset;
mutable ::basegfx::B2DRectangle maBounds; mutable ::basegfx::B2DRectangle maBounds;
......
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