Make memnew(RefCounted) return Ref, to force callers to take ownership of it through a reference.

This commit is contained in:
Lukas Tenbrink
2025-10-23 18:21:08 +02:00
parent 456bdea954
commit 05c33acbb1
58 changed files with 174 additions and 196 deletions
+2 -2
View File
@@ -138,8 +138,8 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bo
CreatePeerFunc *create_fn = protocols.getptr(proto);
ERR_FAIL_NULL_MSG(create_fn, vformat("Invalid protocol: %s.", proto));
RemoteDebuggerPeer *peer = (*create_fn)(p_uri);
if (!peer) {
Ref<RemoteDebuggerPeer> peer = (*create_fn)(p_uri);
if (peer.is_null()) {
return;
}
singleton = memnew(RemoteDebugger(Ref<RemoteDebuggerPeer>(peer)));