diff options
-rw-r--r-- | core/object.cpp | 16 | ||||
-rw-r--r-- | core/object.h | 2 | ||||
-rw-r--r-- | core/resource.cpp | 6 | ||||
-rw-r--r-- | scene/animation/animation_blend_tree.cpp | 5 | ||||
-rw-r--r-- | scene/resources/material.cpp | 2 |
5 files changed, 23 insertions, 8 deletions
diff --git a/core/object.cpp b/core/object.cpp index 4b2869b373..76226d113a 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1530,6 +1530,10 @@ bool Object::is_connected(const StringName &p_signal, Object *p_to_object, const void Object::disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) { + _disconnect(p_signal, p_to_object, p_to_method); +} +void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, bool p_force) { + ERR_FAIL_NULL(p_to_object); Signal *s = signal_map.getptr(p_signal); if (!s) { @@ -1550,9 +1554,11 @@ void Object::disconnect(const StringName &p_signal, Object *p_to_object, const S Signal::Slot *slot = &s->slot_map[target]; - slot->reference_count--; // by default is zero, if it was not referenced it will go below it - if (slot->reference_count >= 0) { - return; + if (!p_force) { + slot->reference_count--; // by default is zero, if it was not referenced it will go below it + if (slot->reference_count >= 0) { + return; + } } p_to_object->connections.erase(slot->cE); @@ -1965,13 +1971,13 @@ Object::~Object() { Connection &c = E->get(); ERR_CONTINUE(c.source != this); //bug? - this->disconnect(c.signal, c.target, c.method); + this->_disconnect(c.signal, c.target, c.method, true); } while (connections.size()) { Connection c = connections.front()->get(); - c.source->disconnect(c.signal, c.target, c.method); + c.source->_disconnect(c.signal, c.target, c.method, true); } ObjectDB::remove_instance(this); diff --git a/core/object.h b/core/object.h index 52c9c509ab..d741371306 100644 --- a/core/object.h +++ b/core/object.h @@ -551,6 +551,8 @@ protected: friend class ClassDB; virtual void _validate_property(PropertyInfo &property) const; + void _disconnect(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, bool p_force = false); + public: //should be protected, but bug in clang++ static void initialize_class(); _FORCE_INLINE_ static void register_custom_data_to_otdb(){}; diff --git a/core/resource.cpp b/core/resource.cpp index 87ff4d3c2a..3078eb135a 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -151,7 +151,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res List<PropertyInfo> plist; get_property_list(&plist); - Resource *r = (Resource *)ClassDB::instance(get_class()); + Resource *r = Object::cast_to<Resource>(ClassDB::instance(get_class())); ERR_FAIL_COND_V(!r, Ref<Resource>()); r->local_scene = p_for_scene; @@ -182,7 +182,9 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res r->set(E->get().name, p); } - return Ref<Resource>(r); + RES res = Ref<Resource>(r); + + return res; } void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache) { diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 31ee31745a..66a9c5babd 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -314,6 +314,11 @@ AnimationNodeOneShot::AnimationNodeOneShot() { mix = MIX_MODE_BLEND; sync = false; + + active = "active"; + prev_active = "prev_active"; + time = "time"; + remaining = "remaining"; } //////////////////////////////////////////////// diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 143a1438ea..d6c22d5664 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -34,7 +34,7 @@ void Material::set_next_pass(const Ref<Material> &p_pass) { - ERR_FAIL_COND(p_pass == this); + ERR_FAIL_COND(p_pass.ptr() == this); if (next_pass == p_pass) return; |