Mark invalid weakptr event handlers as invalid

This commit is contained in:
2020-12-03 21:01:11 +01:00
parent 37073bc9ae
commit 8011c094c7

View File

@@ -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: