godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.93k stars 21.15k forks source link

Editor crashes when saving collision shape #59493

Open MatteoPiovanelli-Laser opened 2 years ago

MatteoPiovanelli-Laser commented 2 years ago

Godot version

4.0.dev (391633760b0ea292af079287faf79c1aee6d9254)

System information

Windows 10

Issue description

Editor crashes after saving a ConvexPolygonShape2D as a new resource image from there it correctly pops the "Save Resource As..." dialog, and the file is saved. However the editor crashes. Upon reopening the project, the created resource is not set to the Shape property of the CollisionShape2D Node.

This is not 100% reliable, I think. I noticed two cases:

  1. Sometimes, in the "Save Resource As..." dialog the preset for the filename is "myscene.tres", in which case upon saving the resource (even with a different name) the editor crashes.
  2. Sometimes, in that dialog the preset for the filename is "new_convex_polygon_shape_2d.tres", in which case the resource will save correctly and the editor will keep working normally.

For other shapes (CapsuleShape2D and so on) I only ever managed to get the second case. I'm not sure what the discriminating factor is in falling in the first case.

Steps to reproduce

See above

Minimal reproduction project

Test.zip

trollodel commented 2 years ago

I can't reproduce it in 603de7a0557cdbdd5405e345b55901f506cc5b40 on Linux. I tried several combinations of the actions described, and none causes a crash.

This is not 100% reliable, I think. I noticed two cases:

  1. Sometimes, in the "Save Resource As..." dialog the preset for the filename is "myscene.tres", in which case upon saving the resource (even with a different name) the editor crashes.
  2. Sometimes, in that dialog the preset for the filename is "new_convex_polygon_shape_2d.tres", in which case the resource will save correctly and the editor will keep working normally.

This depends on the action order, if you create the shape, then save it, the second case happens. Instead, if you create the shape, save the scene with Ctrl+S, then you save the shape, the first case happens.