Discussion:
MochiKit.Signal.signal() not reentrant (locking might break when event handler signals events) (#346)
Christian Zagrodnick
2009-05-30 09:30:14 UTC
Permalink
User-Agent: Unison/1.8.1

Hi,

a few days ago I posted an issue: https://trac.mochikit.com/ticket/346

Since I cannot comment directly there, I'll do that here.

As explained, the issue can be resolved with a semaphore/count. How do
I get the fix into SVN? Would it be possible to get checkin access?

Currently I'm monkey patchting following function for 1.4.2:

signal: function (src, sig) {
var self = MochiKit.Signal;
var observers = self._observers;
src = MochiKit.DOM.getElement(src);
var args = MochiKit.Base.extend(null, arguments, 2);
var errors = [];
self._lock += 1;
for (var i = 0; i < observers.length; i++) {
var ident = observers[i];
if (ident.source === src && ident.signal === sig &&
ident.connected) {
try {
ident.listener.apply(src, args);
} catch (e) {
errors.push(e);
}
}
}
self._lock -= 1;
if (self._dirty && !self._lock) {
self._dirty = false;
for (var i = observers.length - 1; i >= 0; i--) {
if (!observers[i].connected) {
observers.splice(i, 1);
}
}
}
if (errors.length == 1) {
throw errors[0];
} else if (errors.length > 1) {
var e = new Error("Multiple errors thrown in handling
'sig', see errors property");
e.errors = errors;
throw e;
}
}




Regards,
--
Christian Zagrodnick · ***@gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 4 · fax +49 345 1229889 1
Zope and Plone consulting and development



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to mochikit+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---
Loading...