Add an event dispatcher test
Add an event dispatcher test to help reproduce crashes fixed by the previous commit and to verify that the fix still works.