[TextServer] Fix duplicated losing span info, and RID leak.

This commit is contained in:
Pāvels Nadtočajevs
2025-12-11 21:50:22 +02:00
parent 14e840dd75
commit 8fa484f331
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;