### 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)

height = check_icon_h;
				}
				[[fallthrough]];
			}
			case TreeItem::CELL_MODE_STRING:
			case TreeItem::CELL_MODE_CUSTOM:
			case TreeItem::CELL_MODE_ICON: {
				Ref<Texture2D> icon = p_item->cells[i].icon;
				if (!icon.is_null()) {
					Size2i s = _get_cell_icon_size(p_item->cells[i]);
					if (s.height > height) {
						height = s.height;
					}
				}
				if (p_item->cells[i].mode == TreeItem::CELL_MODE_CUSTOM && p_item->cells[i].custom_button) {
					height += theme_cache.custom_button->get_minimum_size().height;
				}
			} break;
			default: {
			}
		}
	}
	int item_min_height = MAX(theme_cache.font->get_height(theme_cache.font_size), p_item->get_custom_minimum_height());
	if (height < item_min_height) {
		height = item_min_height;
	}
	height += theme_cache.v_separation;
	return height;
}
int Tree::get_item_height(TreeItem *p_item) const {