(darren) fixed problem with generator running on destroyed ContainerRef

This commit is contained in:
Justin Butler 2007-04-09 20:25:57 +00:00
parent f7e01783ba
commit ee3d5337d5

View File

@ -329,9 +329,10 @@ class ContainerRef:
evalStr = '' evalStr = ''
curObj = None curObj = None
# make sure the indirections don't go away on us # make sure the indirections don't go away on us
for indirection in self._indirections: indirections = self._indirections
for indirection in indirections:
indirection.acquire() indirection.acquire()
for indirection in self._indirections: for indirection in indirections:
yield None yield None
if not indirection.isDictKey(): if not indirection.isDictKey():
# build up a string to be eval'd # build up a string to be eval'd
@ -343,7 +344,7 @@ class ContainerRef:
# try to look up this key in the curObj dictionary # try to look up this key in the curObj dictionary
curObj = indirection.dereferenceDictKey(curObj) curObj = indirection.dereferenceDictKey(curObj)
evalStr = '' evalStr = ''
for indirection in self._indirections: for indirection in indirections:
yield None yield None
indirection.release() indirection.release()
@ -355,22 +356,23 @@ class ContainerRef:
curIndirection = None curIndirection = None
nextIndirection = None nextIndirection = None
# make sure the indirections don't go away on us # make sure the indirections don't go away on us
for indirection in self._indirections: indirections = self._indirections
for indirection in indirections:
indirection.acquire() indirection.acquire()
for i in xrange(len(self._indirections)): for i in xrange(len(indirections)):
yield None yield None
if i > 0: if i > 0:
prevIndirection = self._indirections[i-1] prevIndirection = indirections[i-1]
else: else:
prevIndirection = None prevIndirection = None
curIndirection = self._indirections[i] curIndirection = indirections[i]
if i < len(self._indirections)-1: if i < len(indirections)-1:
nextIndirection = self._indirections[i+1] nextIndirection = indirections[i+1]
else: else:
nextIndirection = None nextIndirection = None
str += curIndirection.getString(prevIndirection=prevIndirection, str += curIndirection.getString(prevIndirection=prevIndirection,
nextIndirection=nextIndirection) nextIndirection=nextIndirection)
for indirection in self._indirections: for indirection in indirections:
yield None yield None
indirection.release() indirection.release()
yield str yield str