### Godot version

4.1.rc.custom_build. c83f912bc

### System information

Ubuntu 22.04 CI

### Issue description

When executing
```
extends Node
func _process(delta):

	var temp_variable35241 = RichTextLabel.new()
	add_child(temp_variable35241)
	temp_variable35241.set_fit_content(true)
	temp_variable35241.parse_bbcode("3188932498")
	temp_variable35241.queue_free()
```
this code freeze project in CI for at least 60 seconds

### Steps to reproduce

Above

### Minimal reproduction project

N/A
if (crect.has_point(p_click)) {
										for (int j = 0; j < (int)frame->lines.size(); j++) {
											_find_click_in_line(frame, j, rect.position + Vector2(frame->padding.position.x, frame->lines[j].offset.y), rect.size.x, p_click, &table_click_frame, &table_click_line, &table_click_item, &table_click_char, true, p_meta);
											if (table_click_frame && table_click_item) {
												
												table_range = Vector2i(INT32_MAX, 0);
												for (Item *F : table->subitems) {
													ItemFrame *sub_frame = static_cast<ItemFrame *>(F);
													for (int k = 0; k < (int)sub_frame->lines.size(); k++) {
														table_range.x = MIN(table_range.x, sub_frame->lines[k].char_offset);
														table_range.y = MAX(table_range.y, sub_frame->lines[k].char_offset + sub_frame->lines[k].char_count);
													}
												}
												table_offy = off.y;
												table_hit = true;
											}
										}
									}
								}
								idx++;
							}
						} break;
						default:
							break;
					}
				}
			}
		}
		Rect2 rect = Rect2(p_ofs + off - Vector2(0, TS->shaped_text_get_ascent(rid)) - p_frame->padding.position, TS->shaped_text_get_size(rid) + p_frame->padding.position + p_frame->padding.size);
		if (p_table) {