Ensure a caret doesn't receive any new events after destroy is invoked

Deleting the caret before calling ensures there is no way for any external
sources to get access to the soon-to-be destroyed caret.

As part of tracking this down, scheduled tasks will now throw an error
if an attempt is made to trigger the task (either delayed or immediate)
after the particular instance has been destroyed.

This then showed that functions bound to browser events swallow errors
quietly, so additional logging was added to the EventManager delegation
code to ensure errors generated when processing an event are logged.
Merge pull request #620 from peitschie/caret-destroy-fixup

Ensure a caret doesn't receive any new events after destroy is invoked