diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp index 3093441175d..814623257ad 100644 --- a/modules/webrtc/webrtc_peer_connection_js.cpp +++ b/modules/webrtc/webrtc_peer_connection_js.cpp @@ -58,7 +58,7 @@ void WebRTCPeerConnectionJS::_on_error(void *p_obj) { void WebRTCPeerConnectionJS::_on_data_channel(void *p_obj, int p_id) { WebRTCPeerConnectionJS *peer = static_cast(p_obj); - peer->emit_signal("data_channel_received", Ref(new WebRTCDataChannelJS(p_id))); + peer->emit_signal("data_channel_received", Ref(memnew(WebRTCDataChannelJS(p_id)))); } void WebRTCPeerConnectionJS::close() { diff --git a/modules/webrtc/webrtc_peer_connection_js.h b/modules/webrtc/webrtc_peer_connection_js.h index 8c1032e1b7b..2e92fbd4fdf 100644 --- a/modules/webrtc/webrtc_peer_connection_js.h +++ b/modules/webrtc/webrtc_peer_connection_js.h @@ -52,6 +52,8 @@ extern int godot_js_rtc_pc_datachannel_create(int p_id, const char *p_label, con } class WebRTCPeerConnectionJS : public WebRTCPeerConnection { + GDCLASS(WebRTCPeerConnectionJS, WebRTCPeerConnection); + private: int _js_id; ConnectionState _conn_state;