refactor: remove floating_slot_t tag and use return_slot_t instead (#439)

Make all the API consistent by using return_slot_t-based overloads for returning the slots to clients, and overloads without that tag for "floating" slots. floating_slot_t tag was previously added for API backwards compatibility reasons, but now is a (counter-)duplicate to the return_slot_t.
This commit is contained in:
Stanislav Angelovič
2024-04-24 19:28:30 +02:00
parent 2bc9d3ebb3
commit 798eaf8626
10 changed files with 111 additions and 85 deletions

View File

@@ -124,7 +124,11 @@ PendingAsyncCall Proxy::callMethodAsync(const MethodCall& message, async_reply_h
, .proxy = *this
, .floating = false });
asyncCallInfo->slot = connection_->callMethod(message, (void*)&Proxy::sdbus_async_reply_handler, asyncCallInfo.get(), timeout);
asyncCallInfo->slot = connection_->callMethod( message
, (void*)&Proxy::sdbus_async_reply_handler
, asyncCallInfo.get()
, timeout
, return_slot );
auto asyncCallInfoWeakPtr = std::weak_ptr{asyncCallInfo};
@@ -141,7 +145,11 @@ Slot Proxy::callMethodAsync(const MethodCall& message, async_reply_handler async
, .proxy = *this
, .floating = true });
asyncCallInfo->slot = connection_->callMethod(message, (void*)&Proxy::sdbus_async_reply_handler, asyncCallInfo.get(), timeout);
asyncCallInfo->slot = connection_->callMethod( message
, (void*)&Proxy::sdbus_async_reply_handler
, asyncCallInfo.get()
, timeout
, return_slot );
return {asyncCallInfo.release(), [](void *ptr){ delete static_cast<AsyncCallInfo*>(ptr); }};
}
@@ -209,7 +217,8 @@ Slot Proxy::registerSignalHandler( const char* interfaceName
, interfaceName
, signalName
, &Proxy::sdbus_signal_handler
, signalInfo.get() );
, signalInfo.get()
, return_slot );
return {signalInfo.release(), [](void *ptr){ delete static_cast<SignalInfo*>(ptr); }};
}