summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-16 08:50:47 +0200
committerGitHub <noreply@github.com>2020-05-16 08:50:47 +0200
commit5b2c0c342ac0777b01d3a8a852b09bf4ed47a0ee (patch)
treedd9caaaf0c9b02e259719282ac03f01a25a07af7 /modules
parent6815bf42b38c7c3dfde419d86dbc1bf012b035b2 (diff)
parent18332a00948705a333b278855f557df7bb630fd7 (diff)
Merge pull request #38772 from neikeq/issue-38729
websocket: Fix crash at exit when not running the editor
Diffstat (limited to 'modules')
-rw-r--r--modules/websocket/register_types.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp
index 1ad249e1eb..bc50de414e 100644
--- a/modules/websocket/register_types.cpp
+++ b/modules/websocket/register_types.cpp
@@ -42,9 +42,16 @@
#endif
#ifdef TOOLS_ENABLED
#include "editor/debugger/editor_debugger_server.h"
+#include "editor/editor_node.h"
#include "editor_debugger_server_websocket.h"
#endif
+#ifdef TOOLS_ENABLED
+static void _editor_init_callback() {
+ EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create);
+}
+#endif
+
void register_websocket_types() {
#ifdef JAVASCRIPT_ENABLED
EMWSPeer::make_default();
@@ -62,7 +69,7 @@ void register_websocket_types() {
ClassDB::register_custom_instance_class<WebSocketPeer>();
#ifdef TOOLS_ENABLED
- EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create);
+ EditorNode::add_init_callback(&_editor_init_callback);
#endif
}