Fix crash in Release configuration

This commit is contained in:
Jiga228
2025-10-23 23:04:33 +07:00
parent fbf254907d
commit 8d7dcac563
+13 -3
View File
@@ -154,9 +154,19 @@ static void add_owner(object_ptr<Ty>& ptr)
if (ptr_) counter::remove_object<Ty>(ptr_); if (ptr_) counter::remove_object<Ty>(ptr_);
} }
Ty* get() const noexcept { return ptr_.load(); } Ty* get() const { return ptr_.load(); }
Ty& operator*() const noexcept { return *ptr_; } Ty& operator*() const
Ty* operator->() const noexcept { return ptr_.load(); } {
if (!ptr_.load())
throw std::runtime_error("Null pointer");
return *ptr_;
}
Ty* operator->() const
{
if (!ptr_.load())
throw std::runtime_error("Null pointer");
return ptr_.load();
}
operator bool() const noexcept { return ptr_.load() != nullptr; } operator bool() const noexcept { return ptr_.load() != nullptr; }
object_ptr<Ty>& operator=(const object_ptr<Ty>& ptr) object_ptr<Ty>& operator=(const object_ptr<Ty>& ptr)
{ {