Fix Variant Ref<> assignment.
-Creating from object pointer via funcptr API was missing reference initialization. -Supersedes https://github.com/godotengine/godot-cpp/pull/662 -Fixes several crashes in GDExtension
This commit is contained in:
parent
3aa7b7eaf2
commit
3ad3a43063
3 changed files with 21 additions and 4 deletions
|
|
@ -1023,6 +1023,13 @@ bool Variant::is_null() const {
|
|||
}
|
||||
}
|
||||
|
||||
bool Variant::initialize_ref(Object *p_object) {
|
||||
RefCounted *ref_counted = const_cast<RefCounted *>(static_cast<const RefCounted *>(p_object));
|
||||
if (!ref_counted->init_ref()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void Variant::reference(const Variant &p_variant) {
|
||||
switch (type) {
|
||||
case NIL:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue