UI: fix CameraView crash on deleting. (#26390)

* fix crash on delete

* TODO?

* after makeCurrent
old-commit-hash: 97a205c94d
taco
Dean Lee 2 years ago committed by GitHub
parent 15b07085ff
commit 4756106694
  1. 1
      selfdrive/ui/qt/offroad/driverview.cc
  2. 10
      selfdrive/ui/qt/widgets/cameraview.cc
  3. 1
      selfdrive/ui/qt/widgets/cameraview.h

@ -35,6 +35,7 @@ void DriverViewScene::showEvent(QShowEvent* event) {
}
void DriverViewScene::hideEvent(QHideEvent* event) {
// TODO: stop vipc thread ?
params.putBool("IsDriverViewEnabled", false);
}

@ -102,6 +102,7 @@ CameraWidget::CameraWidget(std::string stream_name, VisionStreamType type, bool
CameraWidget::~CameraWidget() {
makeCurrent();
stopVipcThread();
if (isValid()) {
glDeleteVertexArrays(1, &frame_vao);
glDeleteBuffers(1, &frame_vbo);
@ -171,6 +172,15 @@ void CameraWidget::showEvent(QShowEvent *event) {
}
}
void CameraWidget::stopVipcThread() {
if (vipc_thread) {
vipc_thread->requestInterruption();
vipc_thread->quit();
vipc_thread->wait();
vipc_thread = nullptr;
}
}
void CameraWidget::updateFrameMat() {
int w = width(), h = height();

@ -51,6 +51,7 @@ protected:
void updateCalibration(const mat3 &calib);
void vipcThread();
void clearFrames();
void stopVipcThread();
bool zoomed_view;
GLuint frame_vao, frame_vbo, frame_ibo;

Loading…
Cancel
Save