summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-02-13 18:03:28 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-02-13 18:03:28 -0300
commit58cda02a389759d18176216c06f375d364cefef1 (patch)
tree4102902585d12ea6807ceaee1370136d29b601e1 /core
parent1adc330b68b1f6ca18aac05daf88c7d4d757fd0a (diff)
-fixed export templates not loading/exporting on Windows
-fixed TouchScreenButton with stretch2d -fixed(?) OSX crash on startup (test!!) -compilation fixes on windows -CollisionPolygon editor works again -find buttons en find dialog -TileMap editor cleanup (removed "error", made nicer) -viewport flicker fixed -make .scn default extension for saving scenes -export the rest of the network classes to gdscript
Diffstat (limited to 'core')
-rw-r--r--core/io/file_access_network.cpp2
-rw-r--r--core/io/file_access_pack.cpp8
-rw-r--r--core/io/file_access_pack.h15
-rw-r--r--core/io/file_access_zip.cpp3
-rw-r--r--core/io/http_client.cpp2
-rw-r--r--core/io/ioapi.c2
-rw-r--r--core/io/ioapi.h5
-rw-r--r--core/io/stream_peer_tcp.cpp63
-rw-r--r--core/io/stream_peer_tcp.h95
-rw-r--r--core/io/tcp_server.cpp9
-rw-r--r--core/io/tcp_server.h3
-rw-r--r--core/io/unzip.c5
-rw-r--r--core/io/zip.c5
-rw-r--r--core/io/zip_io.h18
-rw-r--r--core/object_type_db.h17
-rw-r--r--core/os/input.h2
-rw-r--r--core/os/os.cpp19
-rw-r--r--core/os/os.h4
-rw-r--r--core/register_core_types.cpp12
-rw-r--r--core/safe_refcount.h8
-rw-r--r--core/script_debugger_remote.cpp2
21 files changed, 194 insertions, 105 deletions
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index a5636b137d..26194040b0 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -243,7 +243,7 @@ FileAccessNetworkClient::FileAccessNetworkClient() {
quit=false;
singleton=this;
last_id=0;
- client = Ref<StreamPeerTCP>( StreamPeerTCP::create() );
+ client = Ref<StreamPeerTCP>( StreamPeerTCP::create_ref() );
sem=Semaphore::create();
lockcount=0;
}
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 4443dd3575..4ae60947fa 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -44,7 +44,7 @@ Error PackedData::add_pack(const String& p_path) {
return ERR_FILE_UNRECOGNIZED;
};
-void PackedData::add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size, PackSource* p_src) {
+void PackedData::add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size,const uint8_t* p_md5, PackSource* p_src) {
bool exists = files.has(path);
@@ -52,6 +52,8 @@ void PackedData::add_path(const String& pkg_path, const String& path, uint64_t o
pf.pack=pkg_path;
pf.offset=ofs;
pf.size=size;
+ for(int i=0;i<16;i++)
+ pf.md5[i]=p_md5[i];
pf.src = p_src;
files[path]=pf;
@@ -163,8 +165,10 @@ bool PackedSourcePCK::try_open_pack(const String& p_path) {
uint64_t ofs = f->get_64();
uint64_t size = f->get_64();
+ uint8_t md5[16];
+ f->get_buffer(md5,16);
- PackedData::get_singleton()->add_path(p_path, path, ofs, size, this);
+ PackedData::get_singleton()->add_path(p_path, path, ofs, size, md5,this);
};
return true;
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 97e236009e..07ce8cbaf8 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -46,8 +46,9 @@ public:
struct PackedFile {
String pack;
- uint64_t offset;
+ uint64_t offset; //if offset is ZERO, the file was ERASED
uint64_t size;
+ uint8_t md5[16];
PackSource* src;
};
@@ -72,7 +73,7 @@ private:
public:
void add_pack_source(PackSource* p_source);
- void add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size, PackSource* p_src); // for PackSource
+ void add_path(const String& pkg_path, const String& path, uint64_t ofs, uint64_t size,const uint8_t* p_md5, PackSource* p_src); // for PackSource
void set_disabled(bool p_disabled) { disabled=p_disabled; }
_FORCE_INLINE_ bool is_disabled() const { return disabled; }
@@ -150,11 +151,13 @@ public:
FileAccess *PackedData::try_open_path(const String& p_path) {
- if (files.has(p_path)) {
- return files[p_path].src->get_file(p_path, &files[p_path]);
- }
+ Map<String,PackedFile>::Element *E=files.find(p_path);
+ if (!E)
+ return NULL; //not found
+ if (E->get().offset==0)
+ return NULL; //was erased
- return NULL;
+ return E->get().src->get_file(p_path, &E->get());
}
bool PackedData::has_path(const String& p_path) {
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 72e929619f..55c0dedad9 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -197,7 +197,8 @@ bool ZipArchive::try_open_pack(const String& p_name) {
String fname = String("res://") + filename_inzip;
files[fname] = f;
- PackedData::get_singleton()->add_path(p_name, fname, 0, 0, this);
+ uint8_t md5[16]={0,0,0,0,0,0,0,0 , 0,0,0,0,0,0,0,0};
+ PackedData::get_singleton()->add_path(p_name, fname, 0, 0, md5, this);
if ((i+1)<gi.number_entry) {
unzGoToNextFile(zfile);
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 33c5f23f6d..1b53ee6104 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -620,7 +620,7 @@ void HTTPClient::_bind_methods() {
HTTPClient::HTTPClient(){
- tcp_connection = StreamPeerTCP::create();
+ tcp_connection = StreamPeerTCP::create_ref();
resolving = IP::RESOLVER_INVALID_ID;
status=STATUS_DISCONNECTED;
conn_port=80;
diff --git a/core/io/ioapi.c b/core/io/ioapi.c
index cc49d775b9..8818199f0b 100644
--- a/core/io/ioapi.c
+++ b/core/io/ioapi.c
@@ -68,6 +68,8 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
+ p_filefunc64_32->zfile_func64.alloc_mem = p_filefunc32->alloc_mem;
+ p_filefunc64_32->zfile_func64.free_mem = p_filefunc32->free_mem;
}
/*
diff --git a/core/io/ioapi.h b/core/io/ioapi.h
index 53d01d65c5..f6934e5866 100644
--- a/core/io/ioapi.h
+++ b/core/io/ioapi.h
@@ -144,6 +144,8 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
+ alloc_func alloc_mem;
+ free_func free_mem;
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
@@ -160,6 +162,9 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
+ alloc_func alloc_mem;
+ free_func free_mem;
+
} zlib_filefunc64_def;
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 0fdaab885a..13a158ea4d 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -26,31 +26,38 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "stream_peer_tcp.h"
-
-StreamPeerTCP* (*StreamPeerTCP::_create)()=NULL;
-
-void StreamPeerTCP::_bind_methods() {
-
- ObjectTypeDB::bind_method(_MD("connect","host","ip"),&StreamPeerTCP::connect);
- ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
- ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
- ObjectTypeDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port);
- ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect);
-}
-
-Ref<StreamPeerTCP> StreamPeerTCP::create() {
-
- if (!_create)
- return Ref<StreamPeerTCP>();
- return Ref<StreamPeerTCP>(_create());
-}
-
-StreamPeerTCP::StreamPeerTCP() {
-
-}
-
-StreamPeerTCP::~StreamPeerTCP() {
-
-};
-
+#include "stream_peer_tcp.h"
+
+StreamPeerTCP* (*StreamPeerTCP::_create)()=NULL;
+
+void StreamPeerTCP::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("connect","host","ip"),&StreamPeerTCP::connect);
+ ObjectTypeDB::bind_method(_MD("is_connected"),&StreamPeerTCP::is_connected);
+ ObjectTypeDB::bind_method(_MD("get_connected_host"),&StreamPeerTCP::get_connected_host);
+ ObjectTypeDB::bind_method(_MD("get_connected_port"),&StreamPeerTCP::get_connected_port);
+ ObjectTypeDB::bind_method(_MD("disconnect"),&StreamPeerTCP::disconnect);
+}
+
+Ref<StreamPeerTCP> StreamPeerTCP::create_ref() {
+
+ if (!_create)
+ return Ref<StreamPeerTCP>();
+ return Ref<StreamPeerTCP>(_create());
+}
+
+StreamPeerTCP* StreamPeerTCP::create() {
+
+ if (!_create)
+ return NULL;
+ return _create();
+}
+
+StreamPeerTCP::StreamPeerTCP() {
+
+}
+
+StreamPeerTCP::~StreamPeerTCP() {
+
+};
+
diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h
index 428ccd3d32..69c9d0c592 100644
--- a/core/io/stream_peer_tcp.h
+++ b/core/io/stream_peer_tcp.h
@@ -26,50 +26,51 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef STREAM_PEER_TCP_H
-#define STREAM_PEER_TCP_H
-
-#include "stream_peer.h"
-
-#include "ip_address.h"
-
-class StreamPeerTCP : public StreamPeer {
-
- OBJ_TYPE( StreamPeerTCP, StreamPeer );
- OBJ_CATEGORY("Networking");
-
-public:
-
- enum Status {
-
- STATUS_NONE,
- STATUS_CONNECTING,
- STATUS_CONNECTED,
- STATUS_ERROR,
- };
-
-protected:
-
- static StreamPeerTCP* (*_create)();
- static void _bind_methods();
-
-public:
-
- virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0;
-
- //read/write from streampeer
-
- virtual bool is_connected() const=0;
- virtual Status get_status() const=0;
- virtual void disconnect()=0;
- virtual IP_Address get_connected_host() const=0;
- virtual uint16_t get_connected_port() const=0;
- virtual void set_nodelay(bool p_enabled)=0;
-
- static Ref<StreamPeerTCP> create();
-
- StreamPeerTCP();
- ~StreamPeerTCP();
-};
-
-#endif
+#ifndef STREAM_PEER_TCP_H
+#define STREAM_PEER_TCP_H
+
+#include "stream_peer.h"
+
+#include "ip_address.h"
+
+class StreamPeerTCP : public StreamPeer {
+
+ OBJ_TYPE( StreamPeerTCP, StreamPeer );
+ OBJ_CATEGORY("Networking");
+
+public:
+
+ enum Status {
+
+ STATUS_NONE,
+ STATUS_CONNECTING,
+ STATUS_CONNECTED,
+ STATUS_ERROR,
+ };
+
+protected:
+
+ static StreamPeerTCP* (*_create)();
+ static void _bind_methods();
+
+public:
+
+ virtual Error connect(const IP_Address& p_host, uint16_t p_port)=0;
+
+ //read/write from streampeer
+
+ virtual bool is_connected() const=0;
+ virtual Status get_status() const=0;
+ virtual void disconnect()=0;
+ virtual IP_Address get_connected_host() const=0;
+ virtual uint16_t get_connected_port() const=0;
+ virtual void set_nodelay(bool p_enabled)=0;
+
+ static Ref<StreamPeerTCP> create_ref();
+ static StreamPeerTCP* create();
+
+ StreamPeerTCP();
+ ~StreamPeerTCP();
+};
+
+#endif
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 06419b9c6b..bce9e19ae3 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -30,13 +30,20 @@
TCP_Server* (*TCP_Server::_create)()=NULL;
-Ref<TCP_Server> TCP_Server::create() {
+Ref<TCP_Server> TCP_Server::create_ref() {
if (!_create)
return NULL;
return Ref<TCP_Server>(_create());
}
+TCP_Server* TCP_Server::create() {
+
+ if (!_create)
+ return NULL;
+ return _create();
+}
+
Error TCP_Server::_listen(uint16_t p_port,DVector<String> p_accepted_hosts) {
List<String> hosts;
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h
index 31949be3b6..fff00e5ce0 100644
--- a/core/io/tcp_server.h
+++ b/core/io/tcp_server.h
@@ -51,7 +51,8 @@ public:
virtual void stop()=0; //stop listening
- static Ref<TCP_Server> create();
+ static Ref<TCP_Server> create_ref();
+ static TCP_Server* create();
TCP_Server();
};
diff --git a/core/io/unzip.c b/core/io/unzip.c
index ac72457f38..39e91834b9 100644
--- a/core/io/unzip.c
+++ b/core/io/unzip.c
@@ -1588,8 +1588,8 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
}
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{
- pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
- pfile_in_zip_read_info->stream.zfree = (free_func)0;
+ pfile_in_zip_read_info->stream.zalloc = s->z_filefunc.zfile_func64.alloc_mem;
+ pfile_in_zip_read_info->stream.zfree = s->z_filefunc.zfile_func64.free_mem;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
@@ -1599,6 +1599,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
else
{
+ printf("NO OPEN ZLIB %i\n",err);
TRYFREE(pfile_in_zip_read_info);
return err;
}
diff --git a/core/io/zip.c b/core/io/zip.c
index edf5560ddb..86c85e116b 100644
--- a/core/io/zip.c
+++ b/core/io/zip.c
@@ -1210,8 +1210,9 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
{
if(zi->ci.method == Z_DEFLATED)
{
- zi->ci.stream.zalloc = (alloc_func)0;
- zi->ci.stream.zfree = (free_func)0;
+ zi->ci.stream.zalloc = zi->z_filefunc.zfile_func64.alloc_mem;
+ zi->ci.stream.zfree = zi->z_filefunc.zfile_func64.free_mem;
+
zi->ci.stream.opaque = (voidpf)0;
if (windowBits>0)
diff --git a/core/io/zip_io.h b/core/io/zip_io.h
index c7d5a70135..2f99113392 100644
--- a/core/io/zip_io.h
+++ b/core/io/zip_io.h
@@ -32,6 +32,7 @@
#include "io/zip.h"
#include "io/unzip.h"
#include "os/file_access.h"
+//#include "copymem.h"
static void* zipio_open(void* data, const char* p_fname, int mode) {
@@ -110,6 +111,21 @@ static int zipio_testerror(voidpf opaque, voidpf stream) {
};
+
+static voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
+
+ voidpf ptr =memalloc(items*size);
+ zeromem(ptr,items*size);
+ return ptr;
+}
+
+
+static void zipio_free(voidpf opaque, voidpf address) {
+
+ memfree(address);
+}
+
+
static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
zlib_filefunc_def io;
@@ -121,6 +137,8 @@ static zlib_filefunc_def zipio_create_io_from_file(FileAccess **p_file) {
io.zseek_file = zipio_seek;
io.zclose_file = zipio_close;
io.zerror_file = zipio_testerror;
+ io.alloc_mem=zipio_alloc;
+ io.free_mem=zipio_free;
return io;
}
diff --git a/core/object_type_db.h b/core/object_type_db.h
index 43a6bb2689..9eaec6171e 100644
--- a/core/object_type_db.h
+++ b/core/object_type_db.h
@@ -205,6 +205,23 @@ public:
//nothing
}
+ template<class T>
+ static Object* _create_ptr_func() {
+
+ return T::create();
+ }
+
+ template<class T>
+ static void register_create_type() {
+
+ GLOBAL_LOCK_FUNCTION;
+ T::initialize_type();
+ TypeInfo *t=types.getptr(T::get_type_static());
+ ERR_FAIL_COND(!t);
+ t->creation_func=&_create_ptr_func<T>;
+ T::register_custom_data_to_otdb();
+ }
+
static void get_type_list( List<String> *p_types);
static void get_inheriters_from( const String& p_type,List<String> *p_types);
static String type_inherits_from(const String& p_type);
diff --git a/core/os/input.h b/core/os/input.h
index 3f62b93972..5987d6ef6c 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -55,7 +55,7 @@ public:
static Input *get_singleton();
- virtual bool is_key_pressed(int p_scancode)=0;
+ virtual bool is_key_pressed(int p_scancode)=0;
virtual bool is_mouse_button_pressed(int p_button)=0;
virtual bool is_joy_button_pressed(int p_device, int p_button)=0;
virtual bool is_action_pressed(const StringName& p_action)=0;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 1ee87099a2..141d5f2b58 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -425,8 +425,25 @@ int OS::get_processor_count() const {
return 1;
}
-void OS::set_mouse_mode(MouseMode p_mode) {
+Error OS::native_video_play(String p_path) {
+
+ return FAILED;
+};
+
+bool OS::native_video_is_playing() {
+
+ return false;
+};
+void OS::native_video_pause() {
+
+};
+
+void OS::native_video_stop() {
+
+};
+
+void OS::set_mouse_mode(MouseMode p_mode) {
}
diff --git a/core/os/os.h b/core/os/os.h
index 5fc4893a97..d77d9bee7f 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -315,6 +315,10 @@ public:
virtual String get_unique_ID() const;
+ virtual Error native_video_play(String p_path);
+ virtual bool native_video_is_playing();
+ virtual void native_video_pause();
+ virtual void native_video_stop();
virtual Error dialog_show(String p_title, String p_description, Vector<String> p_buttons, Object* p_obj, String p_callback);
virtual Error dialog_input_text(String p_title, String p_description, String p_partial, Object* p_obj, String p_callback);
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 6beafc70c9..6d107f97e7 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -106,10 +106,6 @@ void register_core_types() {
object_format_loader_xml = memnew( ObjectFormatLoaderInstancerXML );
ObjectLoader::add_object_format_loader_instancer( object_format_loader_xml );
#endif
- resource_saver_xml = memnew( ResourceFormatSaverXML );
- ResourceSaver::add_resource_format_saver(resource_saver_xml);
- resource_loader_xml = memnew( ResourceFormatLoaderXML );
- ResourceLoader::add_resource_format_loader(resource_loader_xml);
#endif
#ifdef OLD_SCENE_FORMAT_ENABLED
object_format_saver_binary = memnew( ObjectFormatSaverInstancerBinary );
@@ -128,6 +124,10 @@ void register_core_types() {
resource_loader_binary = memnew( ResourceFormatLoaderBinary );
ResourceLoader::add_resource_format_loader(resource_loader_binary);
+ resource_saver_xml = memnew( ResourceFormatSaverXML );
+ ResourceSaver::add_resource_format_saver(resource_saver_xml);
+ resource_loader_xml = memnew( ResourceFormatLoaderXML );
+ ResourceLoader::add_resource_format_loader(resource_loader_xml);
ObjectTypeDB::register_type<Object>();
@@ -136,8 +136,8 @@ void register_core_types() {
ObjectTypeDB::register_type<ResourceImportMetadata>();
ObjectTypeDB::register_type<Resource>();
ObjectTypeDB::register_virtual_type<StreamPeer>();
- ObjectTypeDB::register_virtual_type<StreamPeerTCP>();
- ObjectTypeDB::register_virtual_type<TCP_Server>();
+ ObjectTypeDB::register_create_type<StreamPeerTCP>();
+ ObjectTypeDB::register_create_type<TCP_Server>();
ObjectTypeDB::register_virtual_type<IP>();
ObjectTypeDB::register_virtual_type<PacketPeer>();
ObjectTypeDB::register_type<PacketPeerStream>();
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index 0ee32c3fe7..4357786732 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -148,7 +148,7 @@ static inline int atomic_decrement( volatile int *pw) {
/* PowerPC32/64 GCC */
-#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) )
+#elif ( defined( __GNUC__ ) ) && ( defined( __powerpc__ ) || defined( __ppc__ ) )
#define REFCOUNT_T int
#define REFCOUNT_GET_T int const volatile&
@@ -257,14 +257,14 @@ inline int atomic_decrement(volatile int* v)
/* CW PPC */
-#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
+#elif ( defined( __MWERKS__ ) ) && defined( __POWERPC__ )
inline long atomic_conditional_increment( register long * pw )
{
register int a;
- asm
- {
+ asm
+ {
loop:
lwarx a, 0, pw
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index ce9fff559d..cd8303b542 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -415,7 +415,7 @@ void ScriptDebuggerRemote::set_request_scene_tree_message_func(RequestSceneTreeM
ScriptDebuggerRemote::ScriptDebuggerRemote() {
- tcp_client = StreamPeerTCP::create();
+ tcp_client = StreamPeerTCP::create_ref();
packet_peer_stream = Ref<PacketPeerStream>( memnew(PacketPeerStream) );
packet_peer_stream->set_stream_peer(tcp_client);
mutex = Mutex::create();