mardi 3 novembre 2015

Can I explicitly invoke property destructors so that I can see which one causes problems?

I guess this is a really nasty issue - seems like one of the property destructors of my class creates deadlock. Property destructors are called automatically after class destructor. And I'd like to call them manually and make a log entry after every single one succeeds.

The problem only occurs on devices, where debugger can't be used, so I am using log instead.

Client::~Client() {
    // Stops io service and disconnects sockets
    exit();
    LOG("io_service stopped"<<endl);
    // Destroy IO service
    io_.~io_service();
    LOG("io_service destroyed"<<endl);
}

But the code above actually causes exception, because the ~io_service() gets called twice.

So is there a way to do this properly? If not, what's an alternative to debugging destructors?

Aucun commentaire:

Enregistrer un commentaire