GDNative: Fix size mismatch on 32-bit platforms for Signal and Callable

Fixes #48645.
This commit is contained in:
Rémi Verschelde 2021-05-11 18:35:03 +02:00
parent 048abb50aa
commit ed11756d26
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 6 additions and 3 deletions

View file

@ -44,9 +44,9 @@ class CallableCustom;
// is required. It is designed for the standard case (object and method)
// but can be optimized or customized.
// Enforce 16 bytes with `alignas` to avoid arch-specific alignment issues on x86 vs armv7.
class Callable {
//needs to be max 16 bytes in 64 bits
StringName method;
alignas(8) StringName method;
union {
uint64_t object = 0;
CallableCustom *custom;
@ -138,8 +138,9 @@ public:
// be put inside a Variant, but it is not
// used by the engine itself.
// Enforce 16 bytes with `alignas` to avoid arch-specific alignment issues on x86 vs armv7.
class Signal {
StringName name;
alignas(8) StringName name;
ObjectID object;
public:

View file

@ -37,6 +37,7 @@ extern "C" {
#include <stdint.h>
// Alignment hardcoded in `core/variant/callable.h`.
#define GODOT_CALLABLE_SIZE (16)
#ifndef GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED

View file

@ -37,6 +37,7 @@ extern "C" {
#include <stdint.h>
// Alignment hardcoded in `core/variant/callable.h`.
#define GODOT_SIGNAL_SIZE (16)
#ifndef GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED