refactor: little fixes and reorganizations around Connection class

This commit is contained in:
Stanislav Angelovic
2022-06-22 18:12:42 +02:00
committed by Stanislav Angelovič
parent 2a4c241303
commit b7f3d7c876
12 changed files with 89 additions and 78 deletions
+5 -5
View File
@@ -103,18 +103,18 @@ namespace sdbus::internal {
using SignalName = std::string;
struct SignalData
{
SignalData(Proxy& proxy, signal_handler callback, SlotPtr slot)
SignalData(Proxy& proxy, signal_handler callback, Slot slot)
: proxy(proxy)
, callback(std::move(callback))
, slot(std::move(slot))
{}
Proxy& proxy;
signal_handler callback;
// slot_ must be listed after callback_ to ensure that slot_ is destructed first.
// Destructing the slot_ will sd_bus_slot_unref() the callback.
// slot must be listed after callback to ensure that slot is destructed first.
// Destructing the slot will sd_bus_slot_unref() the callback.
// Only after sd_bus_slot_unref(), we can safely delete the callback. The bus mutex (SdBus::sdbusMutex_)
// ensures that sd_bus_slot_unref() and the callback execute sequentially.
SlotPtr slot;
Slot slot;
};
std::map<SignalName, std::unique_ptr<SignalData>> signals_;
};
@@ -131,7 +131,7 @@ namespace sdbus::internal {
{
Proxy& proxy;
async_reply_handler callback;
MethodCall::Slot slot;
Slot slot;
};
~AsyncCalls()