Crash deleting object on exit, works otherwise

I have the following in a brand new ofApp:

ofApp::setup(){
    m_instance = new Object();
}

ofApp::keyPressed(...){
    if( key == 'a' && m_instance ){
        delete m_instance;
        m_instance = NULL;
    }
}

ofApp::exit(){
    if( m_instance ){
        delete m_instance;
        m_instance = NULL;
    }
}

When I press the ‘a’ key, the object gets deleted properly and I can exit without errors. But if press ESC or close the app instead, my object crashes drastically. This is the actual full code, there isn’t anything else going on in the ofApp loop.

For more details, the Object, does have some threads running that aren’t actually doing much. The error I get is R6025 Pure virtual function call. But I don’t see why it happens only if I delete on exit. This might help me track the issue.

Besides the Object implementation, is there any reason for the exit method to be causing this?