summaryrefslogtreecommitdiffstats
path: root/src/multimedia/camera
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-01-17 09:24:50 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-01-18 07:40:08 +0000
commit42932e1a9dfd6699763b336f552e46f9b1ff30c9 (patch)
treef7bbb86ad697e072509a5b1621712a8d6793c0be /src/multimedia/camera
parent5c91cfff5a8d7a5797c252beaf7493610a971d71 (diff)
Fix QCameraInfo to be invalid if camera failed to find device
Since QCameraInfo uses deviceControl and infoControl to get info about camera, it needs to clear these controls if the camera failed to find a device by name. Change-Id: I1404f70234f978fa4568b6c883a5676f61e08145 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/multimedia/camera')
-rw-r--r--src/multimedia/camera/qcamera.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp
index dba761a0a..46c6af9ff 100644
--- a/src/multimedia/camera/qcamera.cpp
+++ b/src/multimedia/camera/qcamera.cpp
@@ -362,9 +362,17 @@ QCamera::QCamera(const QByteArray& deviceName, QObject *parent):
// The camera should not be used if device with requested name does not exist.
if (!found) {
- if (d->service && d->control)
- d->service->releaseControl(d->control);
+ if (d->service) {
+ if (d->control)
+ d->service->releaseControl(d->control);
+ if (d->deviceControl)
+ d->service->releaseControl(d->deviceControl);
+ if (d->infoControl)
+ d->service->releaseControl(d->infoControl);
+ }
d->control = nullptr;
+ d->deviceControl = nullptr;
+ d->infoControl = nullptr;
d->error = QCamera::ServiceMissingError;
d->errorString = QCamera::tr("The camera service is missing");
}