      if (parser.isSet(name)) {
        replay_flags |= flag;
      }
    }
    replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
    if (!replay->load()) {
      return 0;
    }
    replay->start(parser.value("start").toInt());
    // start keyboard control thread
 
</s> remove   if (replay) {
    replay->stop();
  }
 </s> add  </s> remove   stop();
}

void Replay::stop() {
 </s> add  </s> remove   void stop();
 </s> add  </s> remove Replay *replay = nullptr;
 </s> add 
  Replay *replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
      if (parser.isSet(name)) {
        replay_flags |= flag;
      }
    }
  Replay *replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
    if (!replay->load()) {
      return 0;
    }
    replay->start(parser.value("start").toInt());
    // start keyboard control thread
keep keep keep keep replace keep keep keep keep keep
 replay: fix segfault or hanging on quit (#23323) 
selfdrive/ui/replay/main.cc