cabana: fix stuck on exit (#29796)

fix ctrl+c can't exit when stream dialog displayed on startup
pull/29802/head
Dean Lee 2 years ago committed by GitHub
parent bbf133a2e5
commit 7f23e69cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      tools/cabana/cabana.cc

@ -75,12 +75,7 @@ int main(int argc, char *argv[]) {
} else if (cmd_parser.isSet("demo")) {
route = DEMO_ROUTE;
}
if (route.isEmpty()) {
StreamSelector dlg(&stream);
dlg.exec();
dbc_file = dlg.dbcFile();
} else {
if (!route.isEmpty()) {
auto replay_stream = new ReplayStream(&app);
if (!replay_stream->loadRoute(route, cmd_parser.value("data_dir"), replay_flags)) {
return 0;
@ -89,17 +84,28 @@ int main(int argc, char *argv[]) {
}
}
MainWindow w;
if (!stream) {
stream = new DummyStream(&app);
}
stream->start();
if (!dbc_file.isEmpty()) {
w.loadFile(dbc_file);
int ret = 0;
{
MainWindow w;
QTimer::singleShot(0, [&]() {
if (!stream) {
StreamSelector dlg(&stream);
dlg.exec();
dbc_file = dlg.dbcFile();
}
if (!stream) {
stream = new DummyStream(&app);
}
stream->start();
if (!dbc_file.isEmpty()) {
w.loadFile(dbc_file);
}
w.show();
});
ret = app.exec();
}
w.show();
int ret = app.exec();
delete can;
return ret;
}

Loading…
Cancel
Save