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

if (pressing_for_editor && popup_pressing_edited_item && (popup_pressing_edited_item->get_cell_mode(popup_pressing_edited_item_column) == TreeItem::CELL_MODE_RANGE)) {
			
			popup_edited_item = popup_pressing_edited_item;
			popup_edited_item_col = popup_pressing_edited_item_column;
			popup_pressing_edited_item = nullptr;
			popup_pressing_edited_item_column = -1;
			if (!range_drag_enabled) {
				
				Vector2 cpos = mm->get_position();
				if (rtl) {
					cpos.x = get_size().width - cpos.x;
				}
				if (cpos.distance_to(pressing_pos) > 2) {
					range_drag_enabled = true;
					range_drag_capture_pos = cpos;
					range_drag_base = popup_edited_item->get_range(popup_edited_item_col);
					Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
				}
			} else {
				const TreeItem::Cell &c = popup_edited_item->cells[popup_edited_item_col];
				float diff_y = -mm->get_relative().y;
				diff_y = Math::pow(ABS(diff_y), 1.8f) * SIGN(diff_y);
				diff_y *= 0.1;
				range_drag_base = CLAMP(range_drag_base + c.step * diff_y, c.min, c.max);
				popup_edited_item->set_range(popup_edited_item_col, range_drag_base);
				item_edited(popup_edited_item_col, popup_edited_item);
			}
		}
		if (drag_touching && !drag_touching_deaccel) {
			drag_accum -= mm->get_relative().y;