diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 708efc573983..3b75255ee9ef 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -1035,8 +1035,8 @@ public: // XActiveDataSource } catch (const SAXException& e) { - throw css::lang::WrappedTargetRuntimeException( - e.Message, static_cast(this), e.WrappedException); + throw css::lang::WrappedTargetRuntimeException(e.Message, getXWeak(), + e.WrappedException); } } virtual Reference SAL_CALL getOutputStream() override { return m_out; } diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index 882a7a96dfa7..b6fa70a93875 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -83,8 +83,7 @@ private: /// @note for external binding Reference < XInterface > SAL_CALL OSaxParserTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception) { - OSaxParserTest *p = new OSaxParserTest( rSMgr ); - return Reference < XInterface > ( (static_cast< OWeakObject * >(p)) ); + return getXWeak(new OSaxParserTest( rSMgr )); } OUString OSaxParserTest_getServiceName( ) throw ()