| 635 | } |
| 636 | |
| 637 | void Variant::ObjData::ref_pointer(Object *p_object, bool p_is_weak_ref_old, bool p_is_weak_ref) { |
| 638 | // Mirrors Ref::ref_pointer in refcounted.h |
| 639 | if (p_object == obj) { |
| 640 | return; |
| 641 | } |
| 642 | |
| 643 | ObjData cleanup_ref = *this; |
| 644 | |
| 645 | if (p_object) { |
| 646 | *this = ObjData{ p_object->get_instance_id(), p_object }; |
| 647 | if (!p_is_weak_ref && p_object->is_ref_counted()) { |
| 648 | RefCounted *reference = static_cast<RefCounted *>(p_object); |
| 649 | if (!reference->init_ref()) { |
| 650 | *this = ObjData(); |
| 651 | } |
| 652 | } |
| 653 | } else { |
| 654 | *this = ObjData(); |
| 655 | } |
| 656 | |
| 657 | cleanup_ref.unref(p_is_weak_ref_old); |
| 658 | } |
| 659 | |
| 660 | void Variant::ObjData::unref(bool p_is_weak_ref) { |
| 661 | // Mirrors Ref::unref in refcounted.h |
no test coverage detected