Added a test

to ensure that when contexts are all processed in sequence to trigger the event on each one, the destruction of a yet unprocessed context does not cause the program to attempt to trigger the event on it (as it no longer exists...) when the loop reaches it
Merge remote-tracking branch 'origin/patch-2' into patch-2