Cleanup from jump mode on deactivate of views.

- adds on_selection_modified handling and on_deactivated handling.
- puts a thread lock around the cleanup.