Godot version:
3.2.1, 3.2.2 RC2, 3.2.2 RC3 and 3.22 RC4.
All versions tested are 64-bit for Windows 10.
These are the non-mono builds.
Also tested on v3.2.1 Mono Build 64-bit and same crash bug exists.
OS/device including version:
Windows 10 version 2004 (Build 19041.329)
Issue description:
When creating a "New Single Tile" in Godot and trying to add a Colllision shape it crashes Godot everytime. After Godot crashes when the project is reopened, the Node2D and Tilemap scenes previously added and saved disappear and need to be re-added.
Steps to reproduce:
1) Add Node2D scene
2) Add Tilemap Child Node
3) Create a new Tileset
4) Import the Tile and Zoom into the image so that it's expanded
5) Click on "+ New Single Tile"
6) Enable Snap Grid and set Snap Options with a x,y step of 16 pixels
7) Save the scene and click on the "Collision" button
8) Click on "create a new Rectangle" and select a few areas around the tree

9) Now click on the "Polygon" button right next to and try to add a few polygons around the tree, click around the area a few times, the squares highlighted previously will change in shade.

10) Finally click anywhere else on the image and repeatedly press CTRL+Z to undo changes (but the changes won't undo) and Godot will crash.
11) Reopen the project in Godot and you'll see that all the Scenes have disappeared.
I ran Godot from the command line and here is the error returned when it crashed

Minimal reproduction project:
Tilesets.zip
* Video on how to reproduce error on Windows 10 *
https://youtu.be/KwK6Xv71-9s
I saved the project just prior to pressing CTRL+Z repeatedly, as can be seen in the video, the saved project scene disappears.
* Video showing the Mono Build also crashing and showing saved scenes disappearing even after saving **
https://youtu.be/euxpizeFv0c
Tried to reproduce this, following steps with and without the supplied project, couldn't get it to happen (no crash or out of bounds errors in terminal).
OS: Linux Mint 18.3 Cinnamon 64-bit
Geforce GTX 750 Ti
Godot Version 3.2.2-rc2
Could you produce a video showing the bug in action (doing the steps, crash and disappeared scenes)? I found some of the written steps to be a little ambiguous so I might have been doing it wrong.
Hi, I posted a video on how to reproduce the error:
I saved the project just prior to pressing CTRL+Z repeatedly via CTRL+S, as can be seen in the video, the saved project scene disappears.
Thanks
Thanks for the video.
Following your video I can see that the important part is trying to undo _while in the middle of creating a polygon_. I performed the same action and can confirm that Godot does crash.
If I reload the scene as saved before the crash and keep trying I could not get it to repeat, but deleting the tilemap and doing it over, I could. must delete and remake the rectangle (so you can undo over it), then it can crash.
The important steps (starting at step 5 from first post):
Godot Engine v3.2.2.rc2.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GTX 750 Ti/PCIe/SSE2
ERROR: operator[]: FATAL: Index p_index = -1 is out of bounds (size() = 0).
At: ./core/pool_vector.h:509.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7fed433ce4b0] (??:0)
[2] /home/thomas/Desktop/Godot_v3.2.2-rc2() [0x249314b] (??:?)
... skipped backtrace for brevity because it's useless afaik (no symbols) ...
[16] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fed433b9830] (??:0)
[17] /home/thomas/Desktop/Godot_v3.2.2-rc2() [0x866bde] (??:?)
-- END OF BACKTRACE --
Aborted
I could not replicate the scene deletion effect though. Question: are you sure you are saving successfully? The scene tab continues to say "[unsaved][*]" throughout the video.
Hi,
I recorded the same video again and saved multiple times throughout, same error again and it shows the scenes disappearing.
This time I tested on the Mono build.
I see, scenes are not reopened when the editors restarts; however they are not deleted (screen from the video). The title of this issue should be updated to reflect that.
I'm unable to reproduce this part of your issue (it might be a windows thing), so I don't think I can help with that.
If you'd like though, you could try the following:
and see whether it show the scenes that were open when you last saved, or none at all?
I got backtrace without restarting engine but i'm not sure if I done everything right
[2] TileSetEditor::update_workspace_minsize() (/mnt/Miecz/godot/editor/plugins/tile_set_editor_plugin.cpp:3286)
[3] MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/./core/method_bind.gen.inc:61 (discriminator 4))
[4] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/core/object.cpp:922 (discriminator 1))
[5] UndoRedo::_process_operation_list(List<UndoRedo::Operation, DefaultAllocator>::Element*) (/mnt/Miecz/godot/core/undo_redo.cpp:294 (discriminator 4))
[6] UndoRedo::redo() (/mnt/Miecz/godot/core/undo_redo.cpp:338)
[7] EditorNode::_menu_option_confirm(int, bool) (/mnt/Miecz/godot/editor/editor_node.cpp:2348)
[8] EditorNode::_menu_option(int) (/mnt/Miecz/godot/editor/editor_node.cpp:867)
[9] MethodBind1<int>::call(Object*, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[10] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/core/object.cpp:922 (discriminator 1))
[11] Object::emit_signal(StringName const&, Variant const**, int) (/mnt/Miecz/godot/core/object.cpp:1249 (discriminator 1))
[12] Object::emit_signal(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/mnt/Miecz/godot/core/object.cpp:1307)
[13] PopupMenu::activate_item(int) (/mnt/Miecz/godot/scene/gui/popup_menu.cpp:1167 (discriminator 4))
[14] PopupMenu::activate_item_by_event(Ref<InputEvent> const&, bool) (/mnt/Miecz/godot/scene/gui/popup_menu.cpp:1101)
[15] MenuButton::_unhandled_key_input(Ref<InputEvent>) (/mnt/Miecz/godot/scene/gui/menu_button.cpp:47 (discriminator 6))
[16] MethodBind1<Ref<InputEvent> >::call(Object*, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[17] Object::call_multilevel(StringName const&, Variant const**, int) (/mnt/Miecz/godot/core/object.cpp:764 (discriminator 1))
[18] SceneTree::_call_input_pause(StringName const&, StringName const&, Ref<InputEvent> const&) (/mnt/Miecz/godot/scene/main/scene_tree.cpp:945)
[19] Viewport::unhandled_input(Ref<InputEvent> const&) (/mnt/Miecz/godot/scene/main/viewport.cpp:2837 (discriminator 2))
[20] Viewport::_vp_unhandled_input(Ref<InputEvent> const&) (/mnt/Miecz/godot/scene/main/viewport.cpp:1470)
[21] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[22] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/mnt/Miecz/godot/core/object.cpp:922 (discriminator 1))
[23] Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/mnt/Miecz/godot/core/object.cpp:849)
[24] SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/mnt/Miecz/godot/scene/main/scene_tree.cpp:275)
[25] SceneTree::input_event(Ref<InputEvent> const&) (/mnt/Miecz/godot/scene/main/scene_tree.cpp:448 (discriminator 6))
[26] InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/mnt/Miecz/godot/main/input_default.cpp:416)
[27] InputDefault::parse_input_event(Ref<InputEvent> const&) (/mnt/Miecz/godot/main/input_default.cpp:260)
[28] InputDefault::flush_accumulated_events() (/mnt/Miecz/godot/main/input_default.cpp:679)
[29] OS_X11::process_xevents() (/mnt/Miecz/godot/platform/x11/os_x11.cpp:2698)
[30] OS_X11::run() (/mnt/Miecz/godot/platform/x11/os_x11.cpp:3263)
[31] godot(main+0x125) [0x141cbab] (/mnt/Miecz/godot/platform/x11/godot_x11.cpp:57)
[32] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f848419c0b3] (??:0)
[33] godot(_start+0x2e) [0x141c9ce] (??:?)
I see, scenes are not reopened when the editors restarts; however they are not deleted (screen from the video). The title of this issue should be updated to reflect that.
I'm unable to reproduce this part of your issue (it might be a windows thing), so I don't think I can help with that.
If you'd like though, you could try the following:
- have some scenes open in the editor
- save them
- close the editor normally (no crash)
- restart the editor
- crash the editor
- restart it again
and see whether it show the scenes that were open when you last saved, or none at all?
I found something interesting, the reason why the scenes are not persisting in the tree after reloading the editor is because the Main Scene was not defined.
After defining the main scene (saving the project after this is not required provided the scenes were all saved previously) upon reloading the editor (either without crash or after the crash) all the scenes load normally. Is this standard Godot behaviour or have I inadvertently found another bug?
Hi, I am using 3.2.2 under windows 10 and encountered the exact same issue and was able to reproduce it with the polygon collision editing tiles for the second time.
In my case, the detailed steps to reproduce:
The error message right before the crash is displayed as:
ERROR: operator[]: FATAL: Index p_index = -1 is out of bounds (size() = 0). At ./core/pool_vector.h:509
I managed to reproduce it following these steps (not right away, but eventually I got a crash too while trying again):
ERROR: operator[]: FATAL: Index p_index = -1 is out of bounds (size() = 0).
At: ./core/pool_vector.h:509.
Thread 1 "godot-3.2" received signal SIGILL, Illegal instruction.
0x0000000001bd647c in PoolVector<Vector2>::operator[] (this=0xa23c770, p_index=-1) at ./core/pool_vector.h:509
509 CRASH_BAD_INDEX(p_index, size());
(gdb) bt
#0 0x0000000001bd647c in PoolVector<Vector2>::operator[] (this=0xa23c770, p_index=-1) at ./core/pool_vector.h:509
#1 0x00000000027c5a4a in TileSetEditor::draw_polygon_shapes (this=0xa23c220) at editor/plugins/tile_set_editor_plugin.cpp:2882
#2 0x00000000027a7c96 in TileSetEditor::_on_workspace_draw (this=0xa23c220) at editor/plugins/tile_set_editor_plugin.cpp:1041
#3 0x00000000014cfce8 in MethodBind0::call (this=0xa2f08c0, p_object=0xa23c220, p_args=0x7fffffffc920, p_arg_count=0, r_error=...) at ./core/method_bind.gen.inc:59
#4 0x00000000038e39ca in Object::call (this=0xa23c220, p_method=..., p_args=0x7fffffffc920, p_argcount=0, r_error=...) at core/object.cpp:922
#5 0x00000000038e56a7 in Object::emit_signal (this=0xa27dd80, p_name=..., p_args=0x7fffffffc920, p_argcount=0) at core/object.cpp:1249
#6 0x00000000038e5d51 in Object::emit_signal (this=0xa27dd80, p_name=..., p_arg1=..., p_arg2=..., p_arg3=..., p_arg4=..., p_arg5=...) at core/object.cpp:1306
#7 0x0000000002f87e1c in CanvasItem::_update_callback (this=0xa27dd80) at scene/2d/canvas_item.cpp:460
#8 0x00000000014cfce8 in MethodBind0::call (this=0x61e7d10, p_object=0xa27dd80, p_args=0x0, p_arg_count=0, r_error=...) at ./core/method_bind.gen.inc:59
#9 0x00000000038e39ca in Object::call (this=0xa27dd80, p_method=..., p_args=0x0, p_argcount=0, r_error=...) at core/object.cpp:922
#10 0x00000000038da61c in MessageQueue::_call_function (this=0x55f3ce0, p_target=0xa27dd80, p_func=..., p_args=0x7ffff625b038, p_argcount=0, p_show_error=false) at core/message_queue.cpp:250
#11 0x00000000038da8e3 in MessageQueue::flush (this=0x55f3ce0) at core/message_queue.cpp:297
#12 0x0000000002b1b56b in SceneTree::iteration (this=0x5906ef0, p_time=0.0166666675) at scene/main/scene_tree.cpp:483
#13 0x00000000014628be in Main::iteration () at main/main.cpp:2084
#14 0x0000000001431432 in OS_X11::run (this=0x7fffffffcf40) at platform/x11/os_x11.cpp:3233
#15 0x00000000014216ac in main (argc=2, argv=0x7fffffffd768) at platform/x11/godot_x11.cpp:56
Most helpful comment
I managed to reproduce it following these steps (not right away, but eventually I got a crash too while trying again):