Fix StringName leaks in VariantParser
This commit is contained in:
parent
f8818f85e6
commit
4952d37f4b
|
@ -100,11 +100,9 @@ void StringName::cleanup() {
|
||||||
lost_strings++;
|
lost_strings++;
|
||||||
|
|
||||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||||
if (d->cname) {
|
String dname = String(d->cname ? d->cname : d->name);
|
||||||
print_line("Orphan StringName: " + String(d->cname));
|
|
||||||
} else {
|
print_line(vformat("Orphan StringName: %s (static: %d, total: %d)", dname, d->static_count.get(), d->refcount.get()));
|
||||||
print_line("Orphan StringName: " + String(d->name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +111,7 @@ void StringName::cleanup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lost_strings) {
|
if (lost_strings) {
|
||||||
print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit.");
|
print_verbose(vformat("StringName: %d unclaimed string names at exit.", lost_strings));
|
||||||
}
|
}
|
||||||
configured = false;
|
configured = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1075,7 +1075,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
||||||
return ERR_PARSE_ERROR;
|
return ERR_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HashMap<StringName, Variant::Type> builtin_types;
|
static HashMap<String, Variant::Type> builtin_types;
|
||||||
if (builtin_types.is_empty()) {
|
if (builtin_types.is_empty()) {
|
||||||
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
|
for (int i = 1; i < Variant::VARIANT_MAX; i++) {
|
||||||
builtin_types[Variant::get_type_name((Variant::Type)i)] = (Variant::Type)i;
|
builtin_types[Variant::get_type_name((Variant::Type)i)] = (Variant::Type)i;
|
||||||
|
|
|
@ -40,14 +40,14 @@ StringName WebRTCPeerConnection::default_extension;
|
||||||
|
|
||||||
void WebRTCPeerConnection::set_default_extension(const StringName &p_extension) {
|
void WebRTCPeerConnection::set_default_extension(const StringName &p_extension) {
|
||||||
ERR_FAIL_COND_MSG(!ClassDB::is_parent_class(p_extension, WebRTCPeerConnectionExtension::get_class_static()), vformat("Can't make %s the default WebRTC extension since it does not extend WebRTCPeerConnectionExtension.", p_extension));
|
ERR_FAIL_COND_MSG(!ClassDB::is_parent_class(p_extension, WebRTCPeerConnectionExtension::get_class_static()), vformat("Can't make %s the default WebRTC extension since it does not extend WebRTCPeerConnectionExtension.", p_extension));
|
||||||
default_extension = p_extension;
|
default_extension = StringName(p_extension, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRTCPeerConnection *WebRTCPeerConnection::create() {
|
WebRTCPeerConnection *WebRTCPeerConnection::create() {
|
||||||
#ifdef WEB_ENABLED
|
#ifdef WEB_ENABLED
|
||||||
return memnew(WebRTCPeerConnectionJS);
|
return memnew(WebRTCPeerConnectionJS);
|
||||||
#else
|
#else
|
||||||
if (default_extension == String()) {
|
if (default_extension == StringName()) {
|
||||||
WARN_PRINT_ONCE("No default WebRTC extension configured.");
|
WARN_PRINT_ONCE("No default WebRTC extension configured.");
|
||||||
return memnew(WebRTCPeerConnectionExtension);
|
return memnew(WebRTCPeerConnectionExtension);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue