I hand't thought about opening/closing the view. Thinking about it I believe that we could definitely get into some funky state (I've explained how in the end of this message) but now that I think about it I think we can get into a fishy situation even without `dispose`ing the view (as you might have hinted in the end of your message).

This is how

- Open a Type Hierarchy
- Expand a node that starts a background job
- Before the Job has finished, select a new entity for the Type Hierarchy (this will invoke `inputChanged`)
- Now when the background job finishes it will update the cache with nodes that are entirely unrelated to the current hierarchy!

So it seems that the main culprit is the background job. What if we change the `findInBackground` method such that it only updates the cache if the `input` is the same as when the job started?

*This is how we can get into a nasty situation when closing/opening the view*

If we dispose (i.e. close) the view before the background job is finished the background job might update the cache after the `dispose` and thus the cache wouldn't be empty as we expected.

If the view isn't shown again before a new root for the type hierarchy has been selected this isn't going to be a problem (since that would invoke `inputChanged` which would clear the cache). But it's also possible to show the view using the `show view -> type hierarchy` menu. In this case it might show the old subtypes even though we would expect the cache to be empty.