godotengine / godotengine/godot-cpp

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

Ouverte
#175 12 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug
Langage dominant
C++
Étoiles
2.7k
Forks
810
Merge moyen
1 j 3 h
PR mergées (30 j)
8

Description

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> 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<class StringName,void const *,struct HashMapHasherDefault,struct HashMapComparatorDefault<class StringName>,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...

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le crash provoqué par l’appel NativeScript à get_direct_space_state(), puis inspectez modules/gdnative/nativescript/nativescript.cpp et core/hash_map.h aux emplacements indiqués dans la stack trace. Déterminez pourquoi la ressource locale atteint la recherche de binding qui échoue ; le travail est terminé lorsque l’appel signalé ne provoque plus de crash et qu’une vérification de régression existe.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
game-dev
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
20/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.