bentruyman/bloody-jquery-plugins — pull request #2 by eladzlot (2012-08-03 11:13:57+00:00)
Title: Fixed case where more than one handle unsubscribes in the middle of a publish.

In case that more than one handle unsubscribes in the middle of a
publish, some of the subscriptions don't get unsubscribed, because the
cache is an array and the indexes change in real time.

code to reproduce:
var handle1 = $.subscribe('pubsub',function(){
console.log('first handle1 unsubscribed');
$.unsubscribe(handle1);
});

var handle2 = $.subscribe('pubsub',function(){
console.log('second handle not unsubscribed');
$.unsubscribe(handle2);
});

$.publish('pubsub');