Skip to content

Instantly share code, notes, and snippets.

View drunderscore's full-sized avatar

James Puleo drunderscore

View GitHub Profile

Bowl Storage

A memory corrpution bug triggered in part by a dangling pointer

Dangling Pointer

After initializing the scene, whilst initializing the player, there is a code path that will initialize a global containing the incrediball model instance: xModelInstance* s_incrediball_model_instance. It achieves this by searching for a loaded asset with the hash incrediball_ball. If it is found, it will allocate an xModelInstance from it and store it into s_incrediball_model_instance. If it is not found, s_incrediball_model_instance will be set to null.

The aforementioned code path is ONLY taken when the scene player mapping contains at least one of the player tags listed in the table below. This means that for scenes with none of these player tags, s_incrediball_model_instance will not be initialized.