Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replay: fix segfault or hanging on quit #23323

Merged
merged 1 commit into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions selfdrive/ui/replay/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 0 additions & 4 deletions selfdrive/ui/replay/replay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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...";
Expand Down
1 change: 0 additions & 1 deletion selfdrive/ui/replay/replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Replay : public QObject {
~Replay();
bool load();
void start(int seconds = 0);
void stop();
void pause(bool pause);
bool isPaused() const { return paused_; }

Expand Down