    connect(this, &Replay::segmentChanged, this, &Replay::queueSegment);
  }
  
  Replay::~Replay() {
    stop();
  }
  
  void Replay::stop() {
    if (!stream_thread_ && segments_.empty()) return;
  
    qDebug() << "shutdown: in progress...";
    if (stream_thread_ != nullptr) {
      exit_ = updating_events_ = true;
 
</s> remove   if (replay) {
    replay->stop();
  }
 </s> add  </s> remove   replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app);
 </s> add   Replay *replay = new Replay(route, allow, block, nullptr, replay_flags, parser.value("data_dir"), &app); </s> remove   void stop();
 </s> add  </s> remove Replay *replay = nullptr;
 </s> add 
    connect(this, &Replay::segmentChanged, this, &Replay::queueSegment);
  }
  
  Replay::~Replay() {




    if (!stream_thread_ && segments_.empty()) return;
  
    qDebug() << "shutdown: in progress...";
    if (stream_thread_ != nullptr) {
      exit_ = updating_events_ = true;
keep keep keep keep replace replace replace replace keep keep keep keep keep
 replay: fix segfault or hanging on quit (#23323) 
selfdrive/ui/replay/replay.cc