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

* fix crash on delete

* TODO?

* after makeCurrent
This commit is contained in:
Dean Lee
2022-11-16 11:07:50 +08:00
committed by GitHub
parent f3efc8998c
commit 97a205c94d
3 changed files with 12 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ void DriverViewScene::showEvent(QShowEvent* event) {
}
void DriverViewScene::hideEvent(QHideEvent* event) {
// TODO: stop vipc thread ?
params.putBool("IsDriverViewEnabled", false);
}
+10
View File
@@ -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();
+1
View File
@@ -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;