mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Merge pull request #97316 from lawnjelly/fix_character_platform3
Some checks are pending
🔗 GHA / 📊 Static (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🌐 JavaScript (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / ☁ Server (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
Some checks are pending
🔗 GHA / 📊 Static (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🌐 JavaScript (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / ☁ Server (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
[3.x] Fix physics platform behaviour regression
This commit is contained in:
commit
53ccccab9f
@ -1083,7 +1083,12 @@ Vector3 KinematicBody::_move_and_slide_internal(const Vector3 &p_linear_velocity
|
||||
|
||||
// We need to check the on_floor_body still exists before accessing.
|
||||
// A valid RID is no guarantee that the object has not been deleted.
|
||||
if (ObjectDB::get_instance(on_floor_body_id)) {
|
||||
|
||||
// We can only perform the ObjectDB lifetime check on Object derived objects.
|
||||
// Note that physics also creates RIDs for non-Object derived objects, these cannot
|
||||
// be lifetime checked through ObjectDB, and therefore there is a still a vulnerability
|
||||
// to dangling RIDs (access after free) in this scenario.
|
||||
if (!on_floor_body_id || ObjectDB::get_instance(on_floor_body_id)) {
|
||||
// This approach makes sure there is less delay between the actual body velocity and the one we saved.
|
||||
bs = PhysicsServer::get_singleton()->body_get_direct_state(on_floor_body_rid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user