I've copy-pasted the wrong stack trace on my post. The stack trace I showed was not a result from the code alone. It was produced with the code and a cleanup code below:
extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o)
{
godot::Array al=godot::InputMap::get_singleton()->get_actions();
for (int idx = 0; idx < al.size(); ++idx) {
godot::InputMap::get_singleton()->erase_action(al[idx]);
}
godot::Godot::gdnative_terminate(o);
}
Without this cleanup code, the engine crashes at earlier stage with the similar reason.
godot.windows.tools.64.exe!Reference::unreference() Line 97 C++
godot.windows.tools.64.exe!Ref<InputEvent>::unref() Line 280 C++
godot.windows.tools.64.exe!Ref<InputEvent>::~Ref<InputEvent>() Line 298 C++
[External Code]
godot.windows.tools.64.exe!memdelete_allocator<List<Ref<InputEvent>,DefaultAllocator>::Element,DefaultAllocator>(List<Ref<InputEvent>,DefaultAllocator>::Element * p_class) Line 133 C++
godot.windows.tools.64.exe!List<Ref<InputEvent>,DefaultAllocator>::_Data::erase(const List<Ref<InputEvent>,DefaultAllocator>::Element * p_I) Line 174 C++
godot.windows.tools.64.exe!List<Ref<InputEvent>,DefaultAllocator>::erase(const List<Ref<InputEvent>,DefaultAllocator>::Element * p_I) Line 368 C++
godot.windows.tools.64.exe!List<Ref<InputEvent>,DefaultAllocator>::clear() Line 405 C++
godot.windows.tools.64.exe!List<Ref<InputEvent>,DefaultAllocator>::~List<Ref<InputEvent>,DefaultAllocator>() Line 711 C++
[External Code]
godot.windows.tools.64.exe!memdelete_allocator<Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::Element,DefaultAllocator>(Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::Element * p_class) Line 133 C++
godot.windows.tools.64.exe!Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::_cleanup_tree(Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::Element * p_element) Line 509 C++
godot.windows.tools.64.exe!Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::_cleanup_tree(Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::Element * p_element) Line 507 C++
godot.windows.tools.64.exe!Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::_cleanup_tree(Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::Element * p_element) Line 507 C++
godot.windows.tools.64.exe!Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::clear() Line 664 C++
godot.windows.tools.64.exe!Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>::~Map<StringName,InputMap::Action,Comparator<StringName>,DefaultAllocator>() Line 684 C++
[External Code]
godot.windows.tools.64.exe!memdelete<InputMap>(InputMap * p_class) Line 122 C++
godot.windows.tools.64.exe!Main::cleanup() Line 2090 C++
godot.windows.tools.64.exe!widechar_main(int argc, wchar_t * * argv) Line 153 C++
godot.windows.tools.64.exe!_main() Line 173 C++
godot.windows.tools.64.exe!main(int _argc, char * * _argv) Line 185 C++