app: check against deleted objects when sending events

There is a chance that when the event arrived, the destnation objects
has already been deleted. This commit add magic bits in the object flags
and check it before dispatching the events to window.
Merge pull request #73 from grissiom/object-magic

app: check against deleted objects when sending events