Commit 42932e1a authored by Val Doroshchuk's avatar Val Doroshchuk Committed by VaL Doroshchuk
Browse files

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: default avatarOliver Wolff <oliver.wolff@qt.io>
parent 5c91cfff
Branches
Tags
No related merge requests found
Showing with 10 additions and 2 deletions
...@@ -362,9 +362,17 @@ QCamera::QCamera(const QByteArray& deviceName, QObject *parent): ...@@ -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. // The camera should not be used if device with requested name does not exist.
if (!found) { if (!found) {
if (d->service && d->control) if (d->service) {
d->service->releaseControl(d->control); 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->control = nullptr;
d->deviceControl = nullptr;
d->infoControl = nullptr;
d->error = QCamera::ServiceMissingError; d->error = QCamera::ServiceMissingError;
d->errorString = QCamera::tr("The camera service is missing"); d->errorString = QCamera::tr("The camera service is missing");
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment