Here is the simplest code sample:
var events = {};
var test_ident = connect(events, "test", function()
{
var fail_ident = connect(events, "fail", partial(alert, "Failure"));
disconnect(fail_ident);
signal(events, "fail");
});
signal(events, "test");
Stepping through MochiKit's code briefly reveals that a global lock is
set when the "test" slot is signalled. This lock remains on for the
duration of the failure test.
When you disconnect the newly created fail_ident, it's "connected"
attribute is set to false, but it is not removed from the array of
listeners, because the lock is on.
Now when you signal "fail", MochiKit blindly runs through the list of
matching listeners without checking the "connected" attribute, and the
alert function is invoked.
This was causing some pretty hard to diagnose problems for my app.
Anyone have suggestions or commentary?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---