// Tear down methods should always succeed. // Called from devInit() above under LockComm // Also called when shutting down via devCloseAll() BOOL devClose(PDeviceDescriptor_t d) { if (d != NULL) { if (d->Close != NULL) d->Close(d); ComPort *Com = d->Com; d->Com = NULL; if (Com) { Com->Close(); delete Com; } } return TRUE; }
// Tear down methods should always succeed. // Called from devInit() above under LockComm // Also called when shutting down via devCloseAll() BOOL devClose(PDeviceDescriptor_t d) { if (d != NULL) { if (d->Close != NULL) { d->Close(d); } ComPort *Com = d->Com; if (Com) { Com->Close(); d->Com = NULL; // if we do that before Stop RXThread , Crash .... delete Com; } } return TRUE; }