Fix crash on some platforms in RichTextLabel.

This commit is contained in:
Relintai 2019-09-19 11:16:42 +02:00
parent a1fcac6400
commit 838e474e66

View file

@ -81,7 +81,7 @@ protected:
static void _bind_methods(); static void _bind_methods();
private: private:
struct Item; class Item;
struct Line { struct Line {
@ -103,8 +103,10 @@ private:
} }
}; };
struct Item : public Object { class Item : public Object {
GDCLASS(Item, Object);
public:
int index; int index;
Item *parent; Item *parent;
ItemType type; ItemType type;
@ -127,8 +129,10 @@ private:
virtual ~Item() { _clear_children(); } virtual ~Item() { _clear_children(); }
}; };
struct ItemFrame : public Item { class ItemFrame : public Item {
GDCLASS(ItemFrame, Item);
public:
int parent_line; int parent_line;
bool cell; bool cell;
Vector<Line> lines; Vector<Line> lines;
@ -143,71 +147,95 @@ private:
} }
}; };
struct ItemText : public Item { class ItemText : public Item {
GDCLASS(ItemText, Item);
public:
String text; String text;
ItemText() { type = ITEM_TEXT; } ItemText() { type = ITEM_TEXT; }
}; };
struct ItemImage : public Item { class ItemImage : public Item {
GDCLASS(ItemImage, Item);
public:
Ref<Texture> image; Ref<Texture> image;
ItemImage() { type = ITEM_IMAGE; } ItemImage() { type = ITEM_IMAGE; }
}; };
struct ItemFont : public Item { class ItemFont : public Item {
GDCLASS(ItemFont, Item);
public:
Ref<Font> font; Ref<Font> font;
ItemFont() { type = ITEM_FONT; } ItemFont() { type = ITEM_FONT; }
}; };
struct ItemColor : public Item { class ItemColor : public Item {
GDCLASS(ItemColor, Item);
public:
Color color; Color color;
ItemColor() { type = ITEM_COLOR; } ItemColor() { type = ITEM_COLOR; }
}; };
struct ItemUnderline : public Item { class ItemUnderline : public Item {
GDCLASS(ItemUnderline, Item);
public:
ItemUnderline() { type = ITEM_UNDERLINE; } ItemUnderline() { type = ITEM_UNDERLINE; }
}; };
struct ItemStrikethrough : public Item { class ItemStrikethrough : public Item {
GDCLASS(ItemStrikethrough, Item);
public:
ItemStrikethrough() { type = ITEM_STRIKETHROUGH; } ItemStrikethrough() { type = ITEM_STRIKETHROUGH; }
}; };
struct ItemMeta : public Item { class ItemMeta : public Item {
GDCLASS(ItemMeta, Item);
public:
Variant meta; Variant meta;
ItemMeta() { type = ITEM_META; } ItemMeta() { type = ITEM_META; }
}; };
struct ItemAlign : public Item { class ItemAlign : public Item {
GDCLASS(ItemAlign, Item);
public:
Align align; Align align;
ItemAlign() { type = ITEM_ALIGN; } ItemAlign() { type = ITEM_ALIGN; }
}; };
struct ItemIndent : public Item { class ItemIndent : public Item {
GDCLASS(ItemIndent, Item);
public:
int level; int level;
ItemIndent() { type = ITEM_INDENT; } ItemIndent() { type = ITEM_INDENT; }
}; };
struct ItemList : public Item { class ItemList : public Item {
GDCLASS(ItemList, Item);
public:
ListType list_type; ListType list_type;
ItemList() { type = ITEM_LIST; } ItemList() { type = ITEM_LIST; }
}; };
struct ItemNewline : public Item { class ItemNewline : public Item {
GDCLASS(ItemNewline, Item);
public:
ItemNewline() { type = ITEM_NEWLINE; } ItemNewline() { type = ITEM_NEWLINE; }
}; };
struct ItemTable : public Item { class ItemTable : public Item {
GDCLASS(ItemTable, Item);
public:
struct Column { struct Column {
bool expand; bool expand;
int expand_ratio; int expand_ratio;
@ -221,14 +249,20 @@ private:
ItemTable() { type = ITEM_TABLE; } ItemTable() { type = ITEM_TABLE; }
}; };
struct ItemFade : public Item { class ItemFade : public Item {
GDCLASS(ItemFade, Item);
public:
int starting_index; int starting_index;
int length; int length;
ItemFade() { type = ITEM_FADE; } ItemFade() { type = ITEM_FADE; }
}; };
struct ItemFX : public Item { class ItemFX : public Item {
GDCLASS(ItemFX, Item);
public:
float elapsed_time; float elapsed_time;
ItemFX() { ItemFX() {
@ -236,7 +270,10 @@ private:
} }
}; };
struct ItemShake : public ItemFX { class ItemShake : public ItemFX {
GDCLASS(ItemShake, ItemFX);
public:
int strength; int strength;
float rate; float rate;
uint64_t _current_rng; uint64_t _current_rng;
@ -265,7 +302,10 @@ private:
} }
}; };
struct ItemWave : public ItemFX { class ItemWave : public ItemFX {
GDCLASS(ItemWave, ItemFX);
public:
float frequency; float frequency;
float amplitude; float amplitude;
@ -276,7 +316,10 @@ private:
} }
}; };
struct ItemTornado : public ItemFX { class ItemTornado : public ItemFX {
GDCLASS(ItemTornado, ItemFX);
public:
float radius; float radius;
float frequency; float frequency;
@ -287,7 +330,10 @@ private:
} }
}; };
struct ItemRainbow : public ItemFX { class ItemRainbow : public ItemFX {
GDCLASS(ItemRainbow, ItemFX);
public:
float saturation; float saturation;
float value; float value;
float frequency; float frequency;
@ -300,7 +346,10 @@ private:
} }
}; };
struct ItemCustomFX : public ItemFX { class ItemCustomFX : public ItemFX {
GDCLASS(ItemCustomFX, ItemFX);
public:
String identifier; String identifier;
Dictionary environment; Dictionary environment;