diff --git a/direct/src/ffi/FFIExternalObject.py b/direct/src/ffi/FFIExternalObject.py index b33b980863..94b2561315 100644 --- a/direct/src/ffi/FFIExternalObject.py +++ b/direct/src/ffi/FFIExternalObject.py @@ -108,13 +108,16 @@ class FFIExternalObject: if (exactWrapperClass and (exactWrapperClass != self.__class__)): # Create a new wrapper class instance exactObject = exactWrapperClass(None) - # Get the downcast pointer that has had all the downcast funcs called + + # Get the downcast pointer that has had all the downcast + # funcs called downcastObject = self.downcast(exactWrapperClass) exactObject.this = downcastObject.this exactObject.userManagesMemory = downcastObject.userManagesMemory - # Make sure the original downcast object does not get garbage collected - # so that the exactObject will not get gc'd thereby transferring ownership - # of the object to this new exactObject + # Make sure the original downcast object does not get + # garbage collected so that the exactObject will not get + # gc'd thereby transferring ownership of the object to + # this new exactObject downcastObject.userManagesMemory = 0 return exactObject else: