if (simulation) { // wait for the simulator to exit simulation->wait(); simulation->disconnectSimulation(); simulation->deleteLater(); } #endif _vehicle = NULL; }