bugfix: AbstractEvent didn't disconnect handlers
causing use after free
Dieser Commit ist enthalten in:
Ursprung
feab3a6c52
Commit
bc7025d9eb
@ -30,6 +30,12 @@ AbstractEvent::AbstractEvent(Object& object, std::string_view name, EventFlags f
|
||||
{
|
||||
}
|
||||
|
||||
AbstractEvent::~AbstractEvent()
|
||||
{
|
||||
while(!m_handlers.empty())
|
||||
m_handlers.front()->disconnect();
|
||||
}
|
||||
|
||||
void AbstractEvent::connect(std::shared_ptr<AbstractEventHandler> handler)
|
||||
{
|
||||
assert(handler);
|
||||
|
||||
@ -43,6 +43,7 @@ class AbstractEvent : public InterfaceItem
|
||||
|
||||
public:
|
||||
AbstractEvent(Object& object, std::string_view name, EventFlags m_flags);
|
||||
~AbstractEvent() override;
|
||||
|
||||
inline bool isScriptable() const { return (m_flags & EventFlags::Scriptable) == EventFlags::Scriptable; }
|
||||
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren