### Godot version

4.2 Stable

### System information

Linux

### Issue description

Calling TreeItem set_text() on a TreeItem that was removed via remove_child() causes debugging to end and the application to close without any error message.

### Steps to reproduce

Run the included example to get the debugger to crash. Comment out "treeItem.remove_child(subTreeItem)" for normal behaviour. 

### Minimal reproduction project

[treeItemCrash.zip](https://github.com/godotengine/godot/files/13534005/treeItemCrash.zip)

String s2 = c.text.get_slicec(',', i);
			popup_menu->add_item(s2.get_slicec(':', 0), s2.get_slicec(':', 1).is_empty() ? i : s2.get_slicec(':', 1).to_int());
		}
		popup_menu->set_size(Size2(rect.size.width, 0));
		popup_menu->set_position(get_screen_position() + rect.position + Point2i(0, rect.size.height));
		popup_menu->popup();
		popup_edited_item = s;
		popup_edited_item_col = col;
		return true;
	} else if ((c.mode == TreeItem::CELL_MODE_STRING && !c.edit_multiline) || c.mode == TreeItem::CELL_MODE_RANGE) {
		Rect2 popup_rect;
		int value_editor_height = c.mode == TreeItem::CELL_MODE_RANGE ? value_editor->get_minimum_size().height : 0;
		
		Vector2 ofs(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height - value_editor_height) - rect.size.height) / 2));
		popup_rect.position = get_screen_position() + rect.position - ofs;
		popup_rect.size = rect.size;
		
		Size2 icon_size = _get_cell_icon_size(c);
		popup_rect.position.x += icon_size.x;
		popup_rect.size.x -= icon_size.x;
		line_editor->clear();
		line_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::range_step_decimals(c.step)));
		line_editor->select_all();
		line_editor->show();
		text_editor->hide();
		if (c.mode == TreeItem::CELL_MODE_RANGE) {
			popup_rect.size.y += value_editor_height;
			value_editor->show();
			updating_value_editor = true;
			value_editor->set_min(c.min);