mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 15:02:06 +08:00
UI: fix CameraView crash on deleting. (#26390)
* fix crash on delete * TODO? * after makeCurrent
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user