You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found this when working with the indexing operator in Array. The old code for Array's indexed setter and indexed getter was this:
Variantoperator [](int index) {
final self =Variant(this);
final ret = gde.variantGetIndexed(self, index);
returnconvertFromVariant(ret, null) asVariant;
}
voidoperator []=(int index, Variant value) {
final self =Variant(this);
final variantValue =Variant(value);
gde.variantSetIndexed(self, index, value);
}
Besides being inefficient, this was causing a crash because (I think) the engine was either mangling some pointers or the token was invalid when trying to convert to an Object.
I've taken the following steps to mitigate:
Modified the index getter / setter in the code generation to avoid the extra Variant conversion when the return type is Variant.
Avoid a null token when converting a variant to an Object by always passing in the TypeInfo for GodotObject
Throw an exception if you try to construct a Variant with a Variant.
However, we should take further steps to ensure this isn't a bigger problem.
The text was updated successfully, but these errors were encountered:
Index getters / setters that return variants were crashing because of a bad attempt to cast the object held in the Variant to an Object.
This may be a bigger issue but it is fixed for arrays.
refs: #26
Found this when working with the indexing operator in
Array
. The old code forArray
's indexed setter and indexed getter was this:Besides being inefficient, this was causing a crash because (I think) the engine was either mangling some pointers or the token was invalid when trying to convert to an Object.
I've taken the following steps to mitigate:
token
when converting a variant to an Object by always passing in the TypeInfo forGodotObject
However, we should take further steps to ensure this isn't a bigger problem.
The text was updated successfully, but these errors were encountered: