Explorar el Código

minor refcount tweak

David Rose hace 21 años
padre
commit
5a7bafe065
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      direct/src/distributed/cConnectionRepository.cxx

+ 6 - 0
direct/src/distributed/cConnectionRepository.cxx

@@ -390,7 +390,13 @@ handle_update_field() {
       DCClass *dclass = (DCClass *)PyInt_AsLong(dclass_this);
       Py_DECREF(dclass_this);
 
+      // It's a good idea to ensure the reference count to distobj is
+      // raised while we call the update method--otherwise, the update
+      // method might get into trouble if it tried to delete the
+      // object from the doId2do map.
+      Py_INCREF(distobj);
       dclass->receive_update(distobj, _di); 
+      Py_DECREF(distobj);
     }
   }
 #endif  // HAVE_PYTHON