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

}
			}
			Point2 mouse_position = get_viewport()->get_mouse_position() - get_global_position();
			if (scrolling && get_rect().grow(theme_cache.scroll_border).has_point(mouse_position)) {
				Point2 point;
				if ((ABS(mouse_position.x) < ABS(mouse_position.x - get_size().width)) && (ABS(mouse_position.x) < theme_cache.scroll_border)) {
					point.x = mouse_position.x - theme_cache.scroll_border;
				} else if (ABS(mouse_position.x - get_size().width) < theme_cache.scroll_border) {
					point.x = mouse_position.x - (get_size().width - theme_cache.scroll_border);
				}
				if ((ABS(mouse_position.y) < ABS(mouse_position.y - get_size().height)) && (ABS(mouse_position.y) < theme_cache.scroll_border)) {
					point.y = mouse_position.y - theme_cache.scroll_border;
				} else if (ABS(mouse_position.y - get_size().height) < theme_cache.scroll_border) {
					point.y = mouse_position.y - (get_size().height - theme_cache.scroll_border);
				}
				point *= theme_cache.scroll_speed * get_physics_process_delta_time();
				point += get_scroll();
				h_scroll->set_value(point.x);
				v_scroll->set_value(point.y);
			}
		} break;
		case NOTIFICATION_DRAW: {
			v_scroll->set_custom_step(theme_cache.font->get_height(theme_cache.font_size));
			update_scrollbars();
			RID ci = get_canvas_item();
			Ref<StyleBox> bg = theme_cache.panel_style;
			const Rect2 content_rect = _get_content_rect();
			Point2 draw_ofs = content_rect.position;
			Size2 draw_size = content_rect.size;
			bg->draw(ci, Rect2(Point2(), get_size()));