godotengine / godotengine/godot-cpp

[NativeScript 1.1] Crash attempting to get physics inside of a local resource

オープン
#175 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
C++
スター
2.7k
フォーク
809
平均マージ
1日 3時間
マージ済み PR(30日)
8

説明

I'm probably stretching the possibilities of time and space here but I'm trying to get access to the physics engine inside of a resource.

So I have the following code:
```
printf("Procedural mesh raycast, obtaining local scene\n");
Node * localscene = get_local_scene();
if (localscene == NULL) {
printf("Procedural mesh raycast, no local scene found, is this a local resource?\n");
return false;
};
printf("Procedural mesh raycast, obtaining viewport\n");
Viewport * vp = localscene->get_viewport();
if (vp == NULL) {
printf("Procedural mesh raycast, Couldn't obtain local viewport\n");
return false;
}
printf("Procedural mesh raycast, obtaining world\n");
Ref world = vp->find_world();
if (world.is_null()) {
printf("Procedural mesh raycast, Couldn't obtain world\n");
return false;
}
printf("Procedural mesh raycast, obtaining state\n");
PhysicsDirectSpaceState * state = world->get_direct_space_state();
if (state == NULL) {
printf("Procedural mesh raycast, Couldn't obtain state\n");
return false;
}
```

Which seems to crash on that final get_direct_space_state() call:
```
Procedural mesh raycast, obtaining local scene
Procedural mesh raycast, obtaining viewport
Procedural mesh raycast, obtaining world
Procedural mesh raycast, obtaining state
ERROR: HashMap,3,8>::get: Condition ' !res ' is true. returned: *res
At: c:\users\basti\development\godot3-git\core\hash_map.h:306
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] NativeScriptLanguage::get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:1236)
[1] NativeScriptLanguage::get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:1236)
[2] godot_nativescript_get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\godot_nativescript.cpp:366)
[3] godot_nativescript_init
[4] godot_nativescript_init
[5] godot_nativescript_init
[6] godot_nativescript_init
[7] godot_nativescript_init
[8] godot_nativescript_init
[9] godot_nativescript_init
[10] godot_nativescript_init
[11] godot_nativescript_init
[12] NativeScriptInstance::call (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:736)
[13] Object::call (c:\users\basti\development\godot3-git\core\object.cpp:947)
[14] MessageQueue::_call_function (c:\users\basti\development\godot3-git\core\message_queue.cpp:260)
[15] MessageQueue::flush (c:\users\basti\development\godot3-git\core\message_queue.cpp:307)
[16] SceneTree::iteration (c:\users\basti\development\godot3-git\scene\main\scene_tree.cpp:477)
[17] Main::iteration (c:\users\basti\development\godot3-git\main\main.cpp:1777)
[18] OS_Windows::run (c:\users\basti\development\godot3-git\platform\windows\os_windows.cpp:2605)
[19] widechar_main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:150)
[20] _main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:172)
[21] main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:184)
[22] __scrt_common_main_seh (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283)
[23] BaseThreadInitThunk
-- END OF BACKTRACE --
```

Not sure why...

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず NativeScript から get_direct_space_state() を呼び出した際のクラッシュを再現し、その後、スタックトレースに示された箇所の modules/gdnative/nativescript/nativescript.cpp と core/hash_map.h を調べます。ローカルリソースが失敗する binding lookup に到達する理由を追跡します; 報告された呼び出しでクラッシュが発生しなくなり、回帰チェックがある状態を完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
game-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。