Mark invalid weakptr event handlers as invalid
This commit is contained in:
@@ -45,9 +45,9 @@ namespace openVulkanoCpp
|
||||
|
||||
virtual void Notify(Arguments... args) const = 0;
|
||||
|
||||
bool IsInvalid() const { return invalid; }
|
||||
[[nodiscard]] bool IsInvalid() const { return invalid; }
|
||||
|
||||
void SetInvalid() override { invalid = true; }
|
||||
void SetInvalid() final { invalid = true; }
|
||||
};
|
||||
|
||||
class StaticEventHandler final : public EventHandler
|
||||
@@ -130,6 +130,10 @@ namespace openVulkanoCpp
|
||||
{
|
||||
(instancePtr.get()->*method)(args...);
|
||||
}
|
||||
else
|
||||
{
|
||||
const_cast<InstancedWeakPtrEventHandler*>(this)->SetInvalid();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user