[Zope-Checkins] CVS: Zope/lib/python/ZODB - Connection.py:1.72.6.7

Anthony Baxter anthony@interlink.com.au
Wed, 30 Jul 2003 04:22:33 -0400


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv4731

Modified Files:
      Tag: Zope-2_6-branch
	Connection.py 
Log Message:
Fix exception at shutdown:
  Connection instance has no attribute '_incrgc'" in 
  <method Connection.close of Connection instance at d914b4>
caused by shutdown calling _breakcr() before the connection is closed.


=== Zope/lib/python/ZODB/Connection.py 1.72.6.6 => 1.72.6.7 ===
--- Zope/lib/python/ZODB/Connection.py:1.72.6.6	Tue Jun 10 10:35:29 2003
+++ Zope/lib/python/ZODB/Connection.py	Wed Jul 30 04:22:27 2003
@@ -127,6 +127,7 @@
         except: pass
         try: del self._incrgc
         except: pass
+        self._incrgc = None
         try: del self.cacheGC
         except: pass
 
@@ -270,7 +271,9 @@
         self.__onCloseCallbacks.append(f)
 
     def close(self):
-        self._incrgc() # This is a good time to do some GC
+        # Don't bother if _breakcr has already been called (e.g. at shutdown)
+        if self._incrgc is not None:
+            self._incrgc() # This is a good time to do some GC
 
         # Call the close callbacks.
         if self.__onCloseCallbacks is not None: