Use getXWeak in binaryurp

Change-Id: If1891fc180126aa5d5ac92772cbca9b485619f46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150836
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2023-04-23 20:13:01 +03:00
parent 7e3ddf1e5a
commit c19c775c0b
2 changed files with 13 additions and 13 deletions

View file

@ -332,7 +332,7 @@ void Bridge::terminate(bool final) {
try { try {
listener->disposing( listener->disposing(
css::lang::EventObject( css::lang::EventObject(
static_cast< cppu::OWeakObject * >(this))); getXWeak()));
} catch (const css::uno::RuntimeException & e) { } catch (const css::uno::RuntimeException & e) {
SAL_WARN("binaryurp", "caught " << e); SAL_WARN("binaryurp", "caught " << e);
} }
@ -612,7 +612,7 @@ bool Bridge::makeCall(
{ {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"Binary URP bridge disposed during call", "Binary URP bridge disposed during call",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
*returnValue = resp->returnValue; *returnValue = resp->returnValue;
if (!resp->exception) { if (!resp->exception) {
@ -675,7 +675,7 @@ void Bridge::handleRequestChangeReply(
if (n != exp) { if (n != exp) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: requestChange reply with unexpected return value received", "URP: requestChange reply with unexpected return value received",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
decrementCalls(); decrementCalls();
switch (exp) { switch (exp) {
@ -758,7 +758,7 @@ void Bridge::handleRequestChangeRequest(
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: unexpected requestChange request received", "URP: unexpected requestChange request received",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
} }
@ -809,7 +809,7 @@ void Bridge::handleCommitChangeRequest(
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"URP: unexpected commitChange request received", "URP: unexpected commitChange request received",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
} }
@ -854,7 +854,7 @@ css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
if (sInstanceName.isEmpty()) { if (sInstanceName.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"XBridge::getInstance sInstanceName must be non-empty", "XBridge::getInstance sInstanceName must be non-empty",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) { for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) {
if (sInstanceName[i] > 0x7F) { if (sInstanceName[i] > 0x7F) {
@ -935,7 +935,7 @@ void Bridge::addEventListener(
} }
} }
xListener->disposing( xListener->disposing(
css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); css::lang::EventObject(getXWeak()));
} }
void Bridge::removeEventListener( void Bridge::removeEventListener(
@ -1045,7 +1045,7 @@ void Bridge::checkDisposed() {
if (state_ != STATE_STARTED) { if (state_ != STATE_STARTED) {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"Binary URP bridge already disposed", "Binary URP bridge already disposed",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
} }

View file

@ -93,17 +93,17 @@ css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
if (rBHelper.bDisposed) { if (rBHelper.bDisposed) {
throw css::lang::DisposedException( throw css::lang::DisposedException(
"BridgeFactory disposed", "BridgeFactory disposed",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
if (named_.find(sName) != named_.end()) { if (named_.find(sName) != named_.end()) {
throw css::bridge::BridgeExistsException( throw css::bridge::BridgeExistsException(
sName, static_cast< cppu::OWeakObject * >(this)); sName, getXWeak());
} }
if (sProtocol != "urp" || !aConnection.is()) { if (sProtocol != "urp" || !aConnection.is()) {
throw css::lang::IllegalArgumentException( throw css::lang::IllegalArgumentException(
("BridgeFactory::createBridge: sProtocol != urp ||" ("BridgeFactory::createBridge: sProtocol != urp ||"
" aConnection == null"), " aConnection == null"),
static_cast< cppu::OWeakObject * >(this), -1); getXWeak(), -1);
} }
b.set(new Bridge(this, sName, aConnection, anInstanceProvider)); b.set(new Bridge(this, sName, aConnection, anInstanceProvider));
if (sName.isEmpty()) { if (sName.isEmpty()) {
@ -131,13 +131,13 @@ BridgeFactory::getExistingBridges() {
if (unnamed_.size() > SAL_MAX_INT32) { if (unnamed_.size() > SAL_MAX_INT32) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"BridgeFactory::getExistingBridges: too many", "BridgeFactory::getExistingBridges: too many",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size()); sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size());
if (named_.size() > o3tl::make_unsigned(SAL_MAX_INT32 - n)) { if (named_.size() > o3tl::make_unsigned(SAL_MAX_INT32 - n)) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
"BridgeFactory::getExistingBridges: too many", "BridgeFactory::getExistingBridges: too many",
static_cast< cppu::OWeakObject * >(this)); getXWeak());
} }
n = static_cast< sal_Int32 >(n + named_.size()); n = static_cast< sal_Int32 >(n + named_.size());
css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > s(n); css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > s(n);