Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.2.X] 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.

Backport of r14668 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14669 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2aa47f2b32ada4f78b98765441489bd59445c181 1 parent 4e3c8c6
Honza Král HonzaKral authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 django/dispatch/dispatcher.py
6 django/dispatch/dispatcher.py
View
@@ -99,8 +99,8 @@ def connect(self, receiver, sender=None, weak=True, dispatch_uid=None):
if weak:
receiver = saferef.safeRef(receiver, onDelete=self._remove_receiver)
+ self.lock.acquire()
try:
- self.lock.acquire()
for r_key, _ in self.receivers:
if r_key == lookup_key:
break
@@ -136,8 +136,8 @@ def disconnect(self, receiver=None, sender=None, weak=True, dispatch_uid=None):
else:
lookup_key = (_make_id(receiver), _make_id(sender))
+ self.lock.acquire()
try:
- self.lock.acquire()
for index in xrange(len(self.receivers)):
(r_key, _) = self.receivers[index]
if r_key == lookup_key:
@@ -237,8 +237,8 @@ def _remove_receiver(self, receiver):
Remove dead receivers from connections.
"""
+ self.lock.acquire()
try:
- self.lock.acquire()
to_remove = []
for key, connected_receiver in self.receivers:
if connected_receiver == receiver:
Please sign in to comment.
Something went wrong with that request. Please try again.