summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r--src/qcam/main_window.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index db14245d..38d70633 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -113,8 +113,6 @@ int MainWindow::openCamera(CameraManager *cm)
std::cout << "Using camera " << camera_->name() << std::endl;
- camera_->requestCompleted.connect(this, &MainWindow::requestComplete);
-
return 0;
}
@@ -212,17 +210,23 @@ int MainWindow::startCapture()
goto error;
}
+ camera_->requestCompleted.connect(this, &MainWindow::requestComplete);
+
for (Request *request : requests) {
ret = camera_->queueRequest(request);
if (ret < 0) {
std::cerr << "Can't queue request" << std::endl;
- goto error;
+ goto error_disconnect;
}
}
isCapturing_ = true;
return 0;
+error_disconnect:
+ camera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);
+ camera_->stop();
+
error:
for (Request *request : requests)
delete request;
@@ -249,6 +253,8 @@ void MainWindow::stopCapture()
if (ret)
std::cout << "Failed to stop capture" << std::endl;
+ camera_->requestCompleted.disconnect(this, &MainWindow::requestComplete);
+
for (auto &iter : mappedBuffers_) {
void *memory = iter.second.first;
unsigned int length = iter.second.second;