1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-30 18:30:54 +00:00

Merge pull request #113908 from bruvzg/ts_dup_fix

[TextServer] Fix `duplicated` losing span info, and RID leak.
This commit is contained in:
Thaddeus Crews
2025-12-15 17:40:53 -06:00
4 changed files with 19 additions and 3 deletions

View File

@@ -155,6 +155,7 @@ Ref<TextLine> TextLine::duplicate() const {
Ref<TextLine> copy;
copy.instantiate();
if (rid.is_valid()) {
TS->free_rid(copy->rid);
copy->rid = TS->shaped_text_duplicate(rid);
}
copy->dirty = true;

View File

@@ -328,11 +328,13 @@ Ref<TextParagraph> TextParagraph::duplicate() const {
Ref<TextParagraph> copy;
copy.instantiate();
if (dropcap_rid.is_valid()) {
TS->free_rid(copy->dropcap_rid);
copy->dropcap_rid = TS->shaped_text_duplicate(dropcap_rid);
}
copy->dropcap_lines = dropcap_lines;
copy->dropcap_margins = dropcap_margins;
if (rid.is_valid()) {
TS->free_rid(copy->rid);
copy->rid = TS->shaped_text_duplicate(rid);
}
copy->lines_dirty = true;