InterprocessConnection pure virtual call


#1

Hello, I think this is an issue:

when using an InterprocessConnection with callbacksOnMessageThread = false, the destructor calls disconnect() which then call the connectionLost() callback. This thus causes a virtual call in the destructor, which is not safe.

My crappy workaround:

InterprocessConnection::~InterprocessConnection()
{
    if (!useMessageThread)
      callbackConnectionState = false;
    disconnect();
}

This way, the callbackConnectionState does not change on disconnection, so that the callback is not called.

Francis.


#2

Thanks for spotting that one. Not a bad workaround, I’d say…

I suppose a nicer way to avoid the problem would be to call disconnect() in your subclass’s destructor, as that’d let the callback happen safely as well.


#3