The problem crashes. We need to remove us as listener of the context bar. The following line is missing:

    UIContext::instance()->settings()->selection()->removeObserver(this);