mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-08 15:12:10 +08:00
UI: fix cameraview crash after going offroad in settings window (#23009)
old-commit-hash: c1f617db46e3ed0aa9993dadd278f4f0c0efef6b
This commit is contained in:
@@ -153,16 +153,21 @@ void CameraViewWidget::initializeGL() {
|
||||
|
||||
void CameraViewWidget::showEvent(QShowEvent *event) {
|
||||
latest_frame = nullptr;
|
||||
vipc_thread = new QThread();
|
||||
connect(vipc_thread, &QThread::started, [=]() { vipcThread(); });
|
||||
connect(vipc_thread, &QThread::finished, vipc_thread, &QObject::deleteLater);
|
||||
vipc_thread->start();
|
||||
if (!vipc_thread) {
|
||||
vipc_thread = new QThread();
|
||||
connect(vipc_thread, &QThread::started, [=]() { vipcThread(); });
|
||||
connect(vipc_thread, &QThread::finished, vipc_thread, &QObject::deleteLater);
|
||||
vipc_thread->start();
|
||||
}
|
||||
}
|
||||
|
||||
void CameraViewWidget::hideEvent(QHideEvent *event) {
|
||||
vipc_thread->requestInterruption();
|
||||
vipc_thread->quit();
|
||||
vipc_thread->wait();
|
||||
if (vipc_thread) {
|
||||
vipc_thread->requestInterruption();
|
||||
vipc_thread->quit();
|
||||
vipc_thread->wait();
|
||||
vipc_thread = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CameraViewWidget::updateFrameMat(int w, int h) {
|
||||
|
||||
Reference in New Issue
Block a user