summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_loader.cpp27
-rw-r--r--core/object/script_language.h6
-rw-r--r--core/object/script_language_extension.cpp7
-rw-r--r--core/object/script_language_extension.h18
-rw-r--r--core/variant/variant.cpp2
-rw-r--r--core/variant/variant_utility.cpp14
6 files changed, 33 insertions, 41 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 22bf8571bf..c47f297a72 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -447,15 +447,24 @@ Ref<Resource> ResourceLoader::load_threaded_get(const String &p_path, Error *r_e
ThreadLoadTask &load_task = thread_load_tasks[local_path];
- if (!load_task.cond_var && load_task.status == THREAD_LOAD_IN_PROGRESS) {
- // A condition variable was never created for this task.
- // That happens when a load has been initiated with subthreads disabled,
- // but now another load thread needs to interact with this one (either
- // because of subthreads being used this time, or because it's simply a
- // threaded load running on a different thread).
- // Since we want to be notified when the load ends, we must create the
- // condition variable now.
- load_task.cond_var = memnew(ConditionVariable);
+ if (load_task.status == THREAD_LOAD_IN_PROGRESS) {
+ if (load_task.loader_id == Thread::get_caller_id()) {
+ // Load is in progress, but it's precisely this thread the one in charge.
+ // That means this is a cyclic load.
+ if (r_error) {
+ *r_error = ERR_BUSY;
+ }
+ return Ref<Resource>();
+ } else if (!load_task.cond_var) {
+ // Load is in progress, but a condition variable was never created for it.
+ // That happens when a load has been initiated with subthreads disabled,
+ // but now another load thread needs to interact with this one (either
+ // because of subthreads being used this time, or because it's simply a
+ // threaded load running on a different thread).
+ // Since we want to be notified when the load ends, we must create the
+ // condition variable now.
+ load_task.cond_var = memnew(ConditionVariable);
+ }
}
//cond var still exists, meaning it's still loading, request poll
diff --git a/core/object/script_language.h b/core/object/script_language.h
index 3ef121a8e7..696c9a94a5 100644
--- a/core/object/script_language.h
+++ b/core/object/script_language.h
@@ -249,7 +249,6 @@ public:
virtual void init() = 0;
virtual String get_type() const = 0;
virtual String get_extension() const = 0;
- virtual Error execute_file(const String &p_path) = 0;
virtual void finish() = 0;
/* EDITOR FUNCTIONS */
@@ -428,11 +427,6 @@ public:
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) = 0;
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) = 0;
- virtual void *alloc_instance_binding_data(Object *p_object) { return nullptr; } //optional, not used by all languages
- virtual void free_instance_binding_data(void *p_data) {} //optional, not used by all languages
- virtual void refcount_incremented_instance_binding(Object *p_object) {} //optional, not used by all languages
- virtual bool refcount_decremented_instance_binding(Object *p_object) { return true; } //return true if it can die //optional, not used by all languages
-
virtual void frame();
virtual bool handles_global_class_type(const String &p_type) const { return false; }
diff --git a/core/object/script_language_extension.cpp b/core/object/script_language_extension.cpp
index c7eb32c020..0df9d58334 100644
--- a/core/object/script_language_extension.cpp
+++ b/core/object/script_language_extension.cpp
@@ -84,7 +84,6 @@ void ScriptLanguageExtension::_bind_methods() {
GDVIRTUAL_BIND(_init);
GDVIRTUAL_BIND(_get_type);
GDVIRTUAL_BIND(_get_extension);
- GDVIRTUAL_BIND(_execute_file, "path");
GDVIRTUAL_BIND(_finish);
GDVIRTUAL_BIND(_get_reserved_words);
@@ -144,12 +143,6 @@ void ScriptLanguageExtension::_bind_methods() {
GDVIRTUAL_BIND(_profiling_get_accumulated_data, "info_array", "info_max");
GDVIRTUAL_BIND(_profiling_get_frame_data, "info_array", "info_max");
- GDVIRTUAL_BIND(_alloc_instance_binding_data, "object");
- GDVIRTUAL_BIND(_free_instance_binding_data, "data");
-
- GDVIRTUAL_BIND(_refcount_incremented_instance_binding, "object");
- GDVIRTUAL_BIND(_refcount_decremented_instance_binding, "object");
-
GDVIRTUAL_BIND(_frame);
GDVIRTUAL_BIND(_handles_global_class_type, "type");
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 8e162a1b0f..79cf712119 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -202,7 +202,6 @@ public:
EXBIND0(init)
EXBIND0RC(String, get_type)
EXBIND0RC(String, get_extension)
- EXBIND1R(Error, execute_file, const String &)
EXBIND0(finish)
/* EDITOR FUNCTIONS */
@@ -596,23 +595,6 @@ public:
return ret;
}
- GDVIRTUAL1R(GDExtensionPtr<void>, _alloc_instance_binding_data, Object *)
-
- virtual void *alloc_instance_binding_data(Object *p_object) override {
- GDExtensionPtr<void> ret = nullptr;
- GDVIRTUAL_REQUIRED_CALL(_alloc_instance_binding_data, p_object, ret);
- return ret.operator void *();
- }
-
- GDVIRTUAL1(_free_instance_binding_data, GDExtensionPtr<void>)
-
- virtual void free_instance_binding_data(void *p_data) override {
- GDVIRTUAL_REQUIRED_CALL(_free_instance_binding_data, p_data);
- }
-
- EXBIND1(refcount_incremented_instance_binding, Object *)
- EXBIND1R(bool, refcount_decremented_instance_binding, Object *)
-
EXBIND0(frame)
EXBIND1RC(bool, handles_global_class_type, const String &)
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 04e1561a0c..2da9559873 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -3499,7 +3499,7 @@ bool Variant::identity_compare(const Variant &p_variant) const {
switch (type) {
case OBJECT: {
- return _get_obj().obj == p_variant._get_obj().obj;
+ return _get_obj().id == p_variant._get_obj().id;
} break;
case DICTIONARY: {
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 042ebe368a..8f3ae65b9c 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -543,6 +543,13 @@ struct VariantUtilityFunctions {
Variant base = *p_args[0];
Variant ret;
for (int i = 1; i < p_argcount; i++) {
+ Variant::Type arg_type = p_args[i]->get_type();
+ if (arg_type != Variant::INT && arg_type != Variant::FLOAT) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.expected = Variant::FLOAT;
+ r_error.argument = i;
+ return Variant();
+ }
bool valid;
Variant::evaluate(Variant::OP_LESS, base, *p_args[i], ret, valid);
if (!valid) {
@@ -576,6 +583,13 @@ struct VariantUtilityFunctions {
Variant base = *p_args[0];
Variant ret;
for (int i = 1; i < p_argcount; i++) {
+ Variant::Type arg_type = p_args[i]->get_type();
+ if (arg_type != Variant::INT && arg_type != Variant::FLOAT) {
+ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
+ r_error.expected = Variant::FLOAT;
+ r_error.argument = i;
+ return Variant();
+ }
bool valid;
Variant::evaluate(Variant::OP_GREATER, base, *p_args[i], ret, valid);
if (!valid) {