Browse Source

*** empty log message ***

Joe Shochet 25 years ago
parent
commit
41359848c0
1 changed files with 7 additions and 3 deletions
  1. 7 3
      direct/src/ffi/FFISpecs.py

+ 7 - 3
direct/src/ffi/FFISpecs.py

@@ -330,9 +330,13 @@ class MethodSpecification(FunctionSpecification):
         # The method body will look something like
         #     panda.Class_destructor(self.this)
         self.outputCFunctionComment(file, nesting+2)
-        indent(file, nesting+2, 'if ' + self.typeDescriptor.moduleName + ':\n')
-        indent(file, nesting+3, self.typeDescriptor.moduleName + '.'
-                   + self.typeDescriptor.wrapperName + '(self.this)\n')
+        functionName = (self.typeDescriptor.moduleName + '.'
+                        + self.typeDescriptor.wrapperName)
+        # Make sure the module and function have not been deleted first
+        # This only happens during shutdown
+        indent(file, nesting+2, 'if (' + self.typeDescriptor.moduleName + ' and ' +
+               functionName + '):\n')
+        indent(file, nesting+3, functionName + '(self.this)\n')
 
     def outputDestructorFooter(self, methodClass, file, nesting):
         indent(file, nesting+1, '\n')