Use getXWeak in io

Change-Id: If2b40ecdca67c6d82ff1a87443cb8533401e9ae8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150856
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2023-04-23 20:14:07 +03:00
parent efcbd2306f
commit 87276a497d
4 changed files with 8 additions and 15 deletions

View file

@ -263,14 +263,14 @@ void Pump::run()
if( ! rInput.is() )
{
throw NotConnectedException( "no input stream set", static_cast<OWeakObject*>(this) );
throw NotConnectedException( "no input stream set", getXWeak() );
}
Sequence< sal_Int8 > aData;
while( rInput->readSomeBytes( aData, 65536 ) )
{
if( ! rOutput.is() )
{
throw NotConnectedException( "no output stream set", static_cast<OWeakObject*>(this) );
throw NotConnectedException( "no output stream set", getXWeak() );
}
rOutput->writeBytes( aData );
osl_yieldThread();

View file

@ -326,8 +326,7 @@ void ODataStreamTest::testSimple( const Reference < XDataInputStream > &rInput
**/
Reference < XInterface > SAL_CALL ODataStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
{
ODataStreamTest *p = new ODataStreamTest( rSMgr );
return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) );
return getXWeak(new ODataStreamTest( rSMgr ));
}
Sequence<OUString> ODataStreamTest_getSupportedServiceNames( int i) throw ()
@ -596,8 +595,7 @@ Reference < XInterface > SAL_CALL OMyPersistObject_CreateInstance(
const Reference < XMultiServiceFactory > & rSMgr )
throw(Exception)
{
MyPersistObject *p = new MyPersistObject( );
return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) );
return getXWeak(new MyPersistObject( ));
}
Sequence<OUString> OMyPersistObject_getSupportedServiceNames( ) throw ()
@ -1040,8 +1038,7 @@ void OObjectStreamTest::testObject( const Reference< XObjectOutputStream >
Reference < XInterface > SAL_CALL OObjectStreamTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
{
OObjectStreamTest *p = new OObjectStreamTest( rSMgr );
return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) );
return getXWeak(new OObjectStreamTest( rSMgr ));
}
Sequence<OUString> OObjectStreamTest_getSupportedServiceNames( int i) throw ()

View file

@ -360,8 +360,7 @@ void OMarkableOutputStreamTest::testSimple( const Reference< XOutputStream >
**/
Reference < XInterface > SAL_CALL OMarkableOutputStreamTest_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
{
OMarkableOutputStreamTest *p = new OMarkableOutputStreamTest( rSMgr );
return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) );
return getXWeak(new OMarkableOutputStreamTest( rSMgr ));
}
@ -619,8 +618,7 @@ void OMarkableInputStreamTest::testSimple( const Reference< XOutputStream >
**/
Reference < XInterface > SAL_CALL OMarkableInputStreamTest_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
{
OMarkableInputStreamTest *p = new OMarkableInputStreamTest( rSMgr );
return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) );
return getXWeak(new OMarkableInputStreamTest( rSMgr ));
}

View file

@ -392,9 +392,7 @@ void OPipeTest::testMultithreading( const Reference < XInterface > &r )
**/
Reference < XInterface > SAL_CALL OPipeTest_CreateInstance( const Reference< XMultiServiceFactory> & rSMgr ) throw (Exception)
{
OPipeTest *p = new OPipeTest( rSMgr );
Reference< XInterface > x ( (static_cast< OWeakObject * >(p)) );
return x;
return getXWeak(new OPipeTest( rSMgr ));
}