From e79162ec4e7f7813a38d5df3b508a6dce65bb6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 23 Nov 2020 10:42:44 +0100 Subject: Make warning about Reference singletons more accurate --- core/config/engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 8e2ab094b0..26f8cdf840 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -224,8 +224,9 @@ Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) : name(p_name), ptr(p_ptr) { #ifdef DEBUG_ENABLED - if (Object::cast_to(p_ptr)) { - ERR_PRINT("A class intended to be used as a singleton must *not* inherit from Reference."); + Reference *ref = Object::cast_to(p_ptr); + if (ref && !ref->is_referenced()) { + WARN_PRINT("You must use Ref<> to ensure the lifetime of a Reference object intended to be used as a singleton."); } #endif } -- cgit v1.2.3