diff -ur ../PyODE-snapshot-2010-03-22.orig/src/body.pyx ./src/body.pyx --- ../PyODE-snapshot-2010-03-22.orig/src/body.pyx 2013-04-25 22:19:59.582137101 +1000 +++ ./src/body.pyx 2013-04-25 22:20:30.387025990 +1000 @@ -56,7 +56,7 @@ self.userattribs = {} def __dealloc__(self): - if self.bid!=NULL: + if self.bid!=NULL and self.world: dBodyDestroy(self.bid) def __getattr__(self, name): diff -ur ../PyODE-snapshot-2010-03-22.orig/src/joints.pyx ./src/joints.pyx --- ../PyODE-snapshot-2010-03-22.orig/src/joints.pyx 2013-04-25 22:19:59.583137098 +1000 +++ ./src/joints.pyx 2013-04-25 22:20:38.613993565 +1000 @@ -121,7 +121,7 @@ def __dealloc__(self): self.setFeedback(False) - if self.jid!=NULL: + if self.jid!=NULL and self.world: dJointDestroy(self.jid) def __getattr__(self, name):