avmedia: convert new to ::Create to get initial ref-counting right.

Change-Id: If7441005123ba1427d308b999af84b0c55a94a07
This commit is contained in:
Michael Meeks
2015-04-16 21:04:34 +01:00
parent 5430eb76db
commit 384e705a9e
4 changed files with 12 additions and 12 deletions

View File

@@ -65,13 +65,13 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
Control( pParent ), Control( pParent ),
maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ), maImageList( SvtMiscOptions().AreCurrentSymbolsLarge() ? AVMEDIA_RESID( AVMEDIA_IMGLST_L ) : AVMEDIA_RESID( AVMEDIA_IMGLST ) ),
maItem( 0, AVMediaSetMask::ALL ), maItem( 0, AVMediaSetMask::ALL ),
maPlayToolBox( new ToolBox(this, WB_3DLOOK) ), maPlayToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
maTimeSlider( new Slider(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ), maTimeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK | WB_SLIDERSET) ),
maMuteToolBox( new ToolBox(this, WB_3DLOOK) ), maMuteToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
maVolumeSlider( new Slider(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ), maVolumeSlider( VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_SLIDERSET) ),
maZoomToolBox( new ToolBox(this, WB_3DLOOK) ), maZoomToolBox( VclPtr<ToolBox>::Create(this, WB_3DLOOK) ),
mpZoomListBox( new ListBox( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ), mpZoomListBox( VclPtr<ListBox>::Create( maZoomToolBox.get(), WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL | WB_3DLOOK ) ),
maTimeEdit( new Edit(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ), maTimeEdit( VclPtr<Edit>::Create(this, WB_CENTER | WB_READONLY | WB_BORDER | WB_3DLOOK | WB_READONLY) ),
meControlStyle( eControlStyle ), meControlStyle( eControlStyle ),
mbLocked( false ) mbLocked( false )
{ {

View File

@@ -40,7 +40,7 @@ namespace avmedia
MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) : MediaPlayer::MediaPlayer( vcl::Window* _pParent, sal_uInt16 nId, SfxBindings* _pBindings, SfxChildWinInfo* pInfo ) :
SfxChildWindow( _pParent, nId ) SfxChildWindow( _pParent, nId )
{ {
pWindow = new MediaFloater( _pBindings, this, _pParent ); pWindow = VclPtr<MediaFloater>::Create( _pBindings, this, _pParent );
eChildAlignment = SfxChildAlignment::NOALIGNMENT; eChildAlignment = SfxChildAlignment::NOALIGNMENT;
static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo ); static_cast< MediaFloater* >( pWindow.get() )->Initialize( pInfo );
}; };

View File

@@ -46,7 +46,7 @@ namespace avmedia {
MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) : MediaWindow::MediaWindow( vcl::Window* parent, bool bInternalMediaControl ) :
mpImpl( new priv::MediaWindowImpl( parent, this, bInternalMediaControl ) ) mpImpl( VclPtr<priv::MediaWindowImpl>::Create( parent, this, bInternalMediaControl ) )
{ {
mpImpl->Show(); mpImpl->Show();
} }

View File

@@ -156,7 +156,7 @@ MediaWindowImpl::MediaWindowImpl( vcl::Window* pParent, MediaWindow* pMediaWindo
mpMediaWindow( pMediaWindow ), mpMediaWindow( pMediaWindow ),
mpEvents( NULL ), mpEvents( NULL ),
mbEventTransparent(true), mbEventTransparent(true),
mpMediaWindowControl( bInternalMediaControl ? new MediaWindowControl( this ) : NULL ), mpMediaWindowControl( bInternalMediaControl ? VclPtr<MediaWindowControl>::Create( this ) : nullptr ),
mpEmptyBmpEx( NULL ), mpEmptyBmpEx( NULL ),
mpAudioBmpEx( NULL ) mpAudioBmpEx( NULL )
{ {
@@ -509,14 +509,14 @@ void MediaWindowImpl::onURLChanged()
if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON ) if( m_sMimeType == AVMEDIA_MIMETYPE_COMMON )
{ {
mpChildWindow.disposeAndClear(); mpChildWindow.disposeAndClear();
mpChildWindow.reset(new MediaChildWindow(this) ); mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this) );
} }
#if HAVE_FEATURE_GLTF #if HAVE_FEATURE_GLTF
else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON ) else if ( m_sMimeType == AVMEDIA_MIMETYPE_JSON )
{ {
SystemWindowData aWinData = OpenGLContext::generateWinData(this, false); SystemWindowData aWinData = OpenGLContext::generateWinData(this, false);
mpChildWindow.disposeAndClear(); mpChildWindow.disposeAndClear();
mpChildWindow.reset(new MediaChildWindow(this,&aWinData)); mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this,&aWinData));
mbEventTransparent = false; mbEventTransparent = false;
} }
#endif #endif