Description
the OneWayTunnel::connection_closed code below:
void OneWayTunnel::connection_closed(int result) { if (cont) { #ifdef TEST cout << "OneWayTunnel::connection_closed() ... calling cont" << endl; #endif cont->handleEvent(result ? VC_EVENT_ERROR : VC_EVENT_EOS, cont); } else { OneWayTunnel_free(this); } }
cont->handleEvent(result ? VC_EVENT_ERROR : VC_EVENT_EOS, cont);
It calls cont->handleEvent with `cont'.
If `cont' is not NULL, the handleEvent will free this OneWayTunnel object.
In order to free OneWayTunnel object, `cont' should be replaced by `this'.