### 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
clear();
	append_text(p_bbcode);
}
void RichTextLabel::append_text(const String &p_bbcode) {
	_stop_thread();
	MutexLock data_lock(data_mutex);
	int pos = 0;
	List<String> tag_stack;
	int indent_level = 0;
	bool in_bold = false;
	bool in_italics = false;
	bool after_list_open_tag = false;
	bool after_list_close_tag = false;
	set_process_internal(false);
	while (pos <= p_bbcode.length()) {
		int brk_pos = p_bbcode.find("[", pos);
		if (brk_pos < 0) {
			brk_pos = p_bbcode.length();
		}
		String txt = brk_pos > pos ? p_bbcode.substr(pos, brk_pos - pos) : "";
		
		if (after_list_close_tag || after_list_open_tag) {
			txt = txt.trim_prefix("\n");
		}
		if (brk_pos == p_bbcode.length()) {
			
			if (txt.is_empty() && after_list_open_tag) {
				txt = "\n";