Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript-related crash on exiting the editor #70081

Closed
Zylann opened this issue Dec 14, 2022 · 0 comments · Fixed by #70113
Closed

GDScript-related crash on exiting the editor #70081

Zylann opened this issue Dec 14, 2022 · 0 comments · Fixed by #70113

Comments

@Zylann
Copy link
Contributor

Zylann commented Dec 14, 2022

Godot version

Godot 4 6318320

System information

Windows 10 64 bits NVIDIA GeForce GTX 1060

Issue description

The Godot Editor is crashing on exit, after opening a project with many scripts in them, some of which were opened in the script editor.

This is a similar situation as #69183: to get this crash, I'm using a dev build with debugger attached.
I synced to the latest Godot commit and tried opening and closing my project. It seems #69183 no longer occurs, but it still crashed, in a similar but different way. Godot is accessing deleted memory.

Exception has occurred: W32/0xC0000005
Unhandled exception thrown: read access violation.
this was 0xFFFFFFFFFFFFFFFF.
this: 0xddddddddddddddf5 {type=??? _data={_bool=??? _int=??? _float=??? ...} }

Variant::get_type() Line 330 (godot4_fork\core\variant\variant.h:330)
GDScript::_get_gdscript_from_variant(const Variant & p_variant) Line 1291 (godot4_fork\modules\gdscript\gdscript.cpp:1291)
GDScript::_get_dependencies(RBSet<GDScript *,Comparator<GDScript *>,DefaultAllocator> & p_dependencies, const GDScript * p_except) Line 1346 (godot4_fork\modules\gdscript\gdscript.cpp:1346)
GDScript::get_dependencies() Line 1161 (godot4_fork\modules\gdscript\gdscript.cpp:1161)
GDScript::get_inverted_dependencies() Line 1185 (godot4_fork\modules\gdscript\gdscript.cpp:1185)
GDScript::get_must_clear_dependencies() Line 1200 (godot4_fork\modules\gdscript\gdscript.cpp:1200)
GDScript::clear() Line 1416 (godot4_fork\modules\gdscript\gdscript.cpp:1416)
GDScript::~GDScript() Line 1483 (godot4_fork\modules\gdscript\gdscript.cpp:1483)
GDScript::`scalar deleting destructor'(unsigned int) (Unknown Source:0)
memdelete<RefCounted>(RefCounted * p_class) Line 112 (godot4_fork\core\os\memory.h:112)
Variant::_clear_internal() Line 1357 (godot4_fork\core\variant\variant.cpp:1357)
Variant::clear() Line 304 (godot4_fork\core\variant\variant.h:304)
Variant::~Variant() Line 778 (godot4_fork\core\variant\variant.h:778)
Variant::`scalar deleting destructor'(unsigned int) (Unknown Source:0)
CowData<Variant>::_unref(void * p_data) Line 214 (godot4_fork\core\templates\cowdata.h:214)
CowData<Variant>::~CowData<Variant>() Line 412 (godot4_fork\core\templates\cowdata.h:412)
Vector<Variant>::~Vector<Variant>() Line 287 (godot4_fork\core\templates\vector.h:287)
SceneState::~SceneState() (Unknown Source:0)
SceneState::`scalar deleting destructor'(unsigned int) (Unknown Source:0)
memdelete<SceneState>(SceneState * p_class) Line 112 (godot4_fork\core\os\memory.h:112)
Ref<SceneState>::unref() Line 223 (godot4_fork\core\object\ref_counted.h:223)
Ref<SceneState>::~Ref<SceneState>() Line 233 (godot4_fork\core\object\ref_counted.h:233)
PackedScene::~PackedScene() (Unknown Source:0)
PackedScene::`scalar deleting destructor'(unsigned int) (Unknown Source:0)
memdelete<RefCounted>(RefCounted * p_class) Line 112 (godot4_fork\core\os\memory.h:112)
Variant::_clear_internal() Line 1357 (godot4_fork\core\variant\variant.cpp:1357)
Variant::clear() Line 304 (godot4_fork\core\variant\variant.h:304)
Variant::~Variant() Line 778 (godot4_fork\core\variant\variant.h:778)
KeyValue<StringName,Variant>::~KeyValue<StringName,Variant>() (Unknown Source:0)
HashMapElement<StringName,Variant>::~HashMapElement<StringName,Variant>() (Unknown Source:0)
HashMapElement<StringName,Variant>::`scalar deleting destructor'(unsigned int) (Unknown Source:0)
memdelete<HashMapElement<StringName,Variant>>(HashMapElement<StringName,Variant> * p_class) Line 112 (godot4_fork\core\os\memory.h:112)
DefaultTypedAllocator<HashMapElement<StringName,Variant>>::delete_allocation(HashMapElement<StringName,Variant> * p_allocation) Line 206 (godot4_fork\core\os\memory.h:206)
HashMap<StringName,Variant,HashMapHasherDefault,HashMapComparatorDefault<StringName>,DefaultTypedAllocator<HashMapElement<StringName,Variant>>>::clear() Line 266 (godot4_fork\core\templates\hash_map.h:266)
GDScript::_save_orphaned_subclasses() Line 1383 (godot4_fork\modules\gdscript\gdscript.cpp:1383)
GDScript::clear() Line 1467 (godot4_fork\modules\gdscript\gdscript.cpp:1467)
GDScriptLanguage::finish() Line 2057 (godot4_fork\modules\gdscript\gdscript.cpp:2057)
ScriptServer::finish_languages() Line 210 (godot4_fork\core\object\script_language.cpp:210)
Main::cleanup(bool p_force) Line 3337 (godot4_fork\main\main.cpp:3337)
widechar_main(int argc, wchar_t * * argv) Line 183 (godot4_fork\platform\windows\godot_windows.cpp:183)
_main() Line 203 (godot4_fork\platform\windows\godot_windows.cpp:203)
main(int argc, char * * argv) Line 217 (godot4_fork\platform\windows\godot_windows.cpp:217)
WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 231 (godot4_fork\platform\windows\godot_windows.cpp:231)
invoke_main() Line 107 (d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:107)
__scrt_common_main_seh() Line 288 (d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
__scrt_common_main() Line 331 (d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331)
WinMainCRTStartup(void * __formal) Line 17 (d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp:17)
kernel32.dll!00007fffb64874b4() (Unknown Source:0)
ntdll.dll!00007fffb66626a1() (Unknown Source:0)

Steps to reproduce

Once again, it's unclear what combination of things makes it happen. I tried several projects, and so far only one reproduces this. Which happens to be the project I work on, which as a result is one with a lot of things in it. It seems to reproduce by just opening the project, and closing it.

I can reproduce it with a build of Godot made with the following arguments:

scons p=windows target=editor dev_build=yes warnings=all werror=yes debug_crt=yes -j4

I also had a C++ debugger attached, which is how I got the stack trace.

Minimal reproduction project

http://zylannprods.fr/dl/godot/Project4_gdscript_crash_on_exit.zip

This project is using classes present in my voxel module, but it might not make much of a difference regarding the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants