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

prev_hl_ofs = root_pos.y + Math::floor(parent_line_width / 2);
						} else {
							if (htotal >= 0) {
								RenderingServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x + Math::floor(line_width / 2), root_pos.y), theme_cache.relationship_line_color, line_width);
							}
							RenderingServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y + Math::floor(line_width / 2)), Point2i(parent_pos.x, prev_ofs + Math::floor(line_width / 2)), theme_cache.relationship_line_color, line_width);
						}
					}
				}
				prev_ofs = root_pos.y + more_prev_ofs;
			}
			if (child_h < 0) {
				if (htotal == -1) {
					break; 
				}
				if (theme_cache.draw_relationship_lines == 0) {
					return -1; 
				}
				htotal = -1;
				children_pos.y = theme_cache.offset.y + p_draw_size.height;
			} else {
				htotal += child_h;
				children_pos.y += child_h;
			}
			c = c->next;
		}
	}
	return htotal;
}
int Tree::_count_selected_items(TreeItem *p_from) const {