Skip to content

Crash when trying to save tool scene #104579

@VojtaStruhar

Description

@VojtaStruhar

Tested versions

v4.4.stable.official [4c311cb]

System information

Godot v4.4.stable - macOS Sequoia (15.3.2) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M2 (Apple8) - Apple M2 (8 threads)

Issue description

I'm working on a portals plugin, where a @tool script spawns other nodes while being set up.

When I toggle is_teleport boolean to true in the inspector, the script creates an Area3D node with a CollisionShape3D child. Both are stored in exported property fields.

When I set the is_teleport to false, I only call queue_free only on the area, assuming the collider will get cleaned up too (it's the area's child). But it does not - it remains visible in the inspector exported field. When I try to save, the editor crashes.

My guess would be that it tries to serialize a freed node. When I manually clear the collider property, it saves fine.

Steps to reproduce

I've uploaded a MRP, so this is in relation to that.

  1. Cmd + A Add new "Portal" node (the script will get suggested)
  2. Toggle is_teleport to true, which spawns two nodes. These nodes are visible in the exported properties.

Image

  1. Toggle is_teleport to false. Both nodes disappear from the scene tree, but the collision shape remains in one of the exported fields.
  2. Try to save - Cmd + S

Image

  1. The editor crashes

Minimal reproduction project (MRP)

This is all the code there is to it:
Image

MRP:
mvp-crash.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions