Commit a6593241 authored by Vincent Pelletier's avatar Vincent Pelletier

Invoke message inside a try..finally block to make sure cleanup happens even if message fails.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20925 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a6f3a46
......@@ -856,18 +856,20 @@ class ActivityTool (Folder, UniqueObject):
old_ihotfix_context = False
my_self = self
LOG('CMFActivity.ActivityTool.invoke', INFO, 'Strange: invoke is called outside of acquisition context.')
message(my_self)
if old_ihotfix_context is not False:
# Restore iHotfix context
id = get_ident()
iHotfix._the_lock.acquire()
try:
if old_ihotfix_context is None:
del iHotfix.contexts[id]
else:
iHotfix.contexts[id] = old_ihotfix_context
finally:
iHotfix._the_lock.release()
try:
message(my_self)
finally:
if old_ihotfix_context is not False:
# Restore iHotfix context
id = get_ident()
iHotfix._the_lock.acquire()
try:
if old_ihotfix_context is None:
del iHotfix.contexts[id]
else:
iHotfix.contexts[id] = old_ihotfix_context
finally:
iHotfix._the_lock.release()
if logging:
LOG('Activity Tracking', INFO, 'invoked message')
if my_self is not self: # We rewrapped self
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment