Replaced boost::signals connection by scoped_connection to get rid of disconnects in destructors.
closes #171
Dieser Commit ist enthalten in:
Ursprung
a3c65f457d
Commit
346393d92f
@ -64,14 +64,6 @@ AbstractSignalPath::AbstractSignalPath(SignalRailTile& signal, size_t blocksAhea
|
||||
}
|
||||
}
|
||||
|
||||
AbstractSignalPath::~AbstractSignalPath()
|
||||
{
|
||||
for(auto& connection : m_connections)
|
||||
{
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractSignalPath::evaluate()
|
||||
{
|
||||
const bool stop = !signal().hasReservedPath() && requireReservation();
|
||||
|
||||
@ -155,7 +155,7 @@ class AbstractSignalPath : public Path
|
||||
private:
|
||||
std::unique_ptr<const Item> m_root;
|
||||
bool m_requireReservation = false;
|
||||
std::vector<boost::signals2::connection> m_connections;
|
||||
std::vector<boost::signals2::scoped_connection> m_connections;
|
||||
|
||||
std::unique_ptr<const Item> findBlocks(const Node& node, const Link& link, size_t blocksAhead);
|
||||
|
||||
@ -199,7 +199,7 @@ class AbstractSignalPath : public Path
|
||||
public:
|
||||
AbstractSignalPath(SignalRailTile& signal);
|
||||
AbstractSignalPath(SignalRailTile& signal, size_t blocksAhead);
|
||||
virtual ~AbstractSignalPath();
|
||||
virtual ~AbstractSignalPath() = default;
|
||||
|
||||
void evaluate();
|
||||
};
|
||||
|
||||
@ -42,7 +42,7 @@ class ObjectList : public AbstractObjectList
|
||||
|
||||
protected:
|
||||
Items m_items;
|
||||
std::unordered_map<Object*, boost::signals2::connection> m_propertyChanged;
|
||||
std::unordered_map<Object*, boost::signals2::scoped_connection> m_propertyChanged;
|
||||
std::vector<ObjectListTableModel<T>*> m_models;
|
||||
|
||||
void deleteMethodHandler(const std::shared_ptr<T>& object)
|
||||
@ -121,12 +121,6 @@ class ObjectList : public AbstractObjectList
|
||||
static_assert(std::is_base_of_v<Object, T>);
|
||||
}
|
||||
|
||||
~ObjectList()
|
||||
{
|
||||
for(auto& it : m_propertyChanged)
|
||||
it.second.disconnect();
|
||||
}
|
||||
|
||||
inline const_iterator begin() const noexcept { return m_items.begin(); }
|
||||
inline const_iterator end() const noexcept { return m_items.end(); }
|
||||
inline const std::shared_ptr<T>& front() const noexcept { return m_items.front(); }
|
||||
|
||||
@ -40,8 +40,3 @@ SerialDeviceProperty::SerialDeviceProperty(Object* object, std::string_view name
|
||||
static_cast<VectorRefAttribute<std::string>&>(*it->second).internalChanged();
|
||||
});
|
||||
}
|
||||
|
||||
SerialDeviceProperty::~SerialDeviceProperty()
|
||||
{
|
||||
m_serialPortListChanged.disconnect();
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@
|
||||
class SerialDeviceProperty final : public Property<std::string>
|
||||
{
|
||||
private:
|
||||
boost::signals2::connection m_serialPortListChanged;
|
||||
boost::signals2::scoped_connection m_serialPortListChanged;
|
||||
|
||||
public:
|
||||
SerialDeviceProperty(Object* object, std::string_view name, const std::string& value, PropertyFlags flags);
|
||||
~SerialDeviceProperty() final;
|
||||
~SerialDeviceProperty() final = default;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -54,12 +54,6 @@ InterfaceList::InterfaceList(Object& _parent, std::string_view parentPropertyNam
|
||||
m_interfaceItems.add(delete_);
|
||||
}
|
||||
|
||||
InterfaceList::~InterfaceList()
|
||||
{
|
||||
for(auto& it : m_statusPropertyChanged)
|
||||
it.second.disconnect();
|
||||
}
|
||||
|
||||
TableModelPtr InterfaceList::getModel()
|
||||
{
|
||||
return std::make_shared<InterfaceListTableModel>(*this);
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
class InterfaceList final : public ObjectList<Interface>
|
||||
{
|
||||
private:
|
||||
std::unordered_map<Object*, boost::signals2::connection> m_statusPropertyChanged;
|
||||
std::unordered_map<Object*, boost::signals2::scoped_connection> m_statusPropertyChanged;
|
||||
|
||||
void statusPropertyChanged(BaseProperty& property);
|
||||
|
||||
@ -48,7 +48,7 @@ class InterfaceList final : public ObjectList<Interface>
|
||||
Method<void(const std::shared_ptr<Interface>&)> delete_;
|
||||
|
||||
InterfaceList(Object& _parent, std::string_view parentPropertyName);
|
||||
~InterfaceList() final;
|
||||
~InterfaceList() final = default;
|
||||
|
||||
TableModelPtr getModel() final;
|
||||
};
|
||||
|
||||
@ -367,11 +367,7 @@ OutputMap::OutputMap(Object& _parent, std::string_view parentPropertyName)
|
||||
updateEnabled();
|
||||
}
|
||||
|
||||
OutputMap::~OutputMap()
|
||||
{
|
||||
m_interfaceDestroying.disconnect();
|
||||
m_outputECoSObjectsChanged.disconnect();
|
||||
}
|
||||
OutputMap::~OutputMap() = default;
|
||||
|
||||
void OutputMap::load(WorldLoader& loader, const nlohmann::json& data)
|
||||
{
|
||||
|
||||
@ -50,8 +50,8 @@ class OutputMap : public SubObject
|
||||
static constexpr size_t addressesSizeMin = 1;
|
||||
static constexpr size_t addressesSizeMax = 8;
|
||||
|
||||
boost::signals2::connection m_interfaceDestroying;
|
||||
boost::signals2::connection m_outputECoSObjectsChanged;
|
||||
boost::signals2::scoped_connection m_interfaceDestroying;
|
||||
boost::signals2::scoped_connection m_outputECoSObjectsChanged;
|
||||
|
||||
void addOutput(OutputChannel ch, uint32_t id);
|
||||
void addOutput(OutputChannel ch, uint32_t id, OutputController& outputController);
|
||||
|
||||
@ -55,9 +55,6 @@ Session::Session(const std::shared_ptr<ClientConnection>& connection) :
|
||||
Session::~Session()
|
||||
{
|
||||
assert(isEventLoopThread());
|
||||
m_memoryLoggerChanged.disconnect();
|
||||
for(const auto& it : m_objectSignals)
|
||||
it.second.disconnect();
|
||||
}
|
||||
|
||||
bool Session::processMessage(const Message& message)
|
||||
|
||||
@ -58,7 +58,7 @@ class Session : public std::enable_shared_from_this<Session>
|
||||
static void writeAttribute(Message& message, const AbstractAttribute& attribute);
|
||||
static void writeTypeInfo(Message& message, const TypeInfo& typeInfo);
|
||||
|
||||
boost::signals2::connection m_memoryLoggerChanged;
|
||||
boost::signals2::scoped_connection m_memoryLoggerChanged;
|
||||
|
||||
protected:
|
||||
using Handle = uint32_t;
|
||||
@ -67,7 +67,7 @@ class Session : public std::enable_shared_from_this<Session>
|
||||
std::shared_ptr<ClientConnection> m_connection;
|
||||
boost::uuids::uuid m_uuid;
|
||||
Handles m_handles;
|
||||
std::unordered_multimap<Handle, boost::signals2::connection> m_objectSignals;
|
||||
std::unordered_multimap<Handle, boost::signals2::scoped_connection> m_objectSignals;
|
||||
|
||||
bool processMessage(const Message& message);
|
||||
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren