mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
fix a bug
This commit is contained in:
parent
620e82f0ab
commit
31e24ca9bd
@ -73,8 +73,10 @@ struct PyBody{
|
|||||||
PyBody(): body(nullptr), fixture(nullptr), node_like(nullptr){}
|
PyBody(): body(nullptr), fixture(nullptr), node_like(nullptr){}
|
||||||
|
|
||||||
void _gc_mark() {
|
void _gc_mark() {
|
||||||
|
if(node_like != nullptr){
|
||||||
PK_OBJ_MARK(node_like);
|
PK_OBJ_MARK(node_like);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PyBody& _() { return *this; }
|
PyBody& _() { return *this; }
|
||||||
b2Body& _b2Body() { return *body; }
|
b2Body& _b2Body() { return *body; }
|
||||||
|
@ -128,7 +128,7 @@ void PyBody::_register(VM* vm, PyObject* mod, PyObject* type){
|
|||||||
|
|
||||||
// destroy
|
// destroy
|
||||||
vm->bind(type, "destroy(self)", [](VM* vm, ArgsView args){
|
vm->bind(type, "destroy(self)", [](VM* vm, ArgsView args){
|
||||||
PyBody& body = CAST(PyBody&, args[1]);
|
PyBody& body = CAST(PyBody&, args[0]);
|
||||||
body.body->GetWorld()->DestroyBody(body.body);
|
body.body->GetWorld()->DestroyBody(body.body);
|
||||||
body.body = nullptr;
|
body.body = nullptr;
|
||||||
body.fixture = nullptr;
|
body.fixture = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user