summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/object.cpp15
-rw-r--r--core/object.h4
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
3 files changed, 11 insertions, 10 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 21666a334c..21a3b2cc6c 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1213,9 +1213,9 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int
MessageQueue::get_singleton()->push_call(target->get_instance_id(), c.method, args, argc, true);
} else {
Variant::CallError ce;
- s->lock++;
+ _emitting = true;
target->call(c.method, args, argc, ce);
- s->lock--;
+ _emitting = false;
if (ce.error != Variant::CallError::CALL_OK) {
#ifdef DEBUG_ENABLED
@@ -1920,6 +1920,7 @@ Object::Object() {
_instance_id = ObjectDB::add_instance(this);
_can_translate = true;
_is_queued_for_deletion = false;
+ _emitting = false;
instance_binding_count = 0;
memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS);
script_instance = NULL;
@@ -1942,15 +1943,15 @@ Object::~Object() {
const StringName *S = NULL;
+ if (_emitting) {
+ //@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
+ ERR_PRINTS("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
+ }
+
while ((S = signal_map.next(NULL))) {
Signal *s = &signal_map[*S];
- if (s->lock > 0) {
- //@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
- ERR_PRINTS("Object was freed or unreferenced while signal '" + String(*S) + "' is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
- }
-
//brute force disconnect for performance
int slot_count = s->slot_map.size();
const VMap<Signal::Target, Signal::Slot>::Pair *slot_list = s->slot_map.get_array();
diff --git a/core/object.h b/core/object.h
index ad1865da7b..865c155764 100644
--- a/core/object.h
+++ b/core/object.h
@@ -465,8 +465,7 @@ private:
MethodInfo user;
VMap<Target, Slot> slot_map;
- int lock;
- Signal() { lock = 0; }
+ Signal() {}
};
HashMap<StringName, Signal> signal_map;
@@ -481,6 +480,7 @@ private:
bool _predelete();
void _postinitialize();
bool _can_translate;
+ bool _emitting;
#ifdef TOOLS_ENABLED
bool _edited;
uint32_t _edited_version;
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 0a528552cc..712120c7f4 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -1865,7 +1865,7 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
glTexImage2D(GL_TEXTURE_2D, 0, internal_format, p_radiance_size, 2.0 * p_radiance_size, 0, format, type, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_tex, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#ifdef DEBUG_ENABLED
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);