Closed chenjie199234 closed 2 hours ago
You shouldn't use memdelete
for these, they are RefCounted
, instead use Ref<StreamPeerTCP> tcppeer = memnew(StreamPeerTCP);
and do not delete it, you should just use scope for it
@AThousandShips new without delete? will it cause a memory leak
No because it's a reference counted type, it's protected by scope
@AThousandShips thanks.i think it works like c++'s new and delete. but the disconnect is still wrong. i can't disconnect on tcp and tls peer together
Please fix your code to use the correct types and upload a minimal project to test this
@AThousandShips tested by myself use memnew with Ref,works fine. sorry,i think the memnew is like the c++'s new
It is like new
but this type is reference counted, like std::shared_ptr
Tested versions
4.3 stable
System information
windows 11 Godot 4.3.stable
Issue description
program corruption,debug stopped Unexpected
Steps to reproduce
here is the c++ code in GodotExtension
Minimal reproduction project (MRP)
code above