Remove some unused headers.
Don't crash if there's no model set yet.

Happens when only setting the model later, or swapping it at runtime, as
done by the model inspector for the content model.
Update handler map when registering a new handler.

This fixes handler destruction monitoring.
Make a copy of the object name, to avoid its const ref becoming invalid.

The server side implementation of handlerDestroyed() calls unregister-
MessageHandlerInternal() which in turn deletes the ObjectInfo instance
holding the name, making the const ref we pass in invalid. Therefore delay
the destruction of the QString a bit until we are done with it.
Add methods to unregister a selection model and check for its existence.
Fix typo in slot name.
Add singleton accessor to Endpoint.

Useful in code that is shared between client and server and thus doesn't
know which Endpoint sub-class to deal with.
Watch out for the model being deleted.

Another corner case found by trying to port the model inspector, which
uses this with models we don't control the lifetime of.
Core/UI split for the model inspector.

Model index details are not yet working remotely though.