replay: fix segfault or hanging on quit (#23323)

old-commit-hash: c9da1403bcb4491db0fd9ee9e2e921c630ad96a9
This commit is contained in:
Dean Lee
2021-12-28 05:02:18 +08:00
committed by GitHub
parent 44498de2e6
commit 446e59d10f
3 changed files with 1 additions and 10 deletions
+1 -5
View File
@@ -11,16 +11,12 @@
const QString DEMO_ROUTE = "4cf7a6ad03080c90|2021-09-29--13-46-36";
struct termios oldt = {};
Replay *replay = nullptr;
void sigHandler(int s) {
std::signal(s, SIG_DFL);
if (oldt.c_lflag) {
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
}
if (replay) {
replay->stop();
}
qApp->quit();
}
@@ -134,7 +130,7 @@ int main(int argc, char *argv[]) {
replay_flags |= flag;
}
}
replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
Replay *replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
if (!replay->load()) {
return 0;
}
-4
View File
@@ -36,10 +36,6 @@ Replay::Replay(QString route, QStringList allow, QStringList block, SubMaster *s
}
Replay::~Replay() {
stop();
}
void Replay::stop() {
if (!stream_thread_ && segments_.empty()) return;
qDebug() << "shutdown: in progress...";
-1
View File
@@ -28,7 +28,6 @@ public:
~Replay();
bool load();
void start(int seconds = 0);
void stop();
void pause(bool pause);
bool isPaused() const { return paused_; }