mirror of https://github.com/django/django.git
Preventing problems possibly introduced by r14662
acquire a lock before entering a try block that ends with the lock's release. Thanks for the catch Alex. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
65b380e74a
commit
aee9db9b3e
|
@ -99,8 +99,8 @@ class Signal(object):
|
||||||
if weak:
|
if weak:
|
||||||
receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)
|
receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)
|
||||||
|
|
||||||
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
self.lock.acquire()
|
|
||||||
for r_key, _ in self.receivers:
|
for r_key, _ in self.receivers:
|
||||||
if r_key == lookup_key:
|
if r_key == lookup_key:
|
||||||
break
|
break
|
||||||
|
@ -136,8 +136,8 @@ class Signal(object):
|
||||||
else:
|
else:
|
||||||
lookup_key = (_make_id(receiver), _make_id(sender))
|
lookup_key = (_make_id(receiver), _make_id(sender))
|
||||||
|
|
||||||
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
self.lock.acquire()
|
|
||||||
for index in xrange(len(self.receivers)):
|
for index in xrange(len(self.receivers)):
|
||||||
(r_key, _) = self.receivers[index]
|
(r_key, _) = self.receivers[index]
|
||||||
if r_key == lookup_key:
|
if r_key == lookup_key:
|
||||||
|
@ -237,8 +237,8 @@ class Signal(object):
|
||||||
Remove dead receivers from connections.
|
Remove dead receivers from connections.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
self.lock.acquire()
|
|
||||||
to_remove = []
|
to_remove = []
|
||||||
for key, connected_receiver in self.receivers:
|
for key, connected_receiver in self.receivers:
|
||||||
if connected_receiver == receiver:
|
if connected_receiver == receiver:
|
||||||
|
|
Loading…
Reference in New Issue