summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-10-27 14:02:14 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-12-14 13:25:02 +0000
commit9caee039533168fbb546b563859770414e54fc94 (patch)
treec3e2dd5f02618de97df2382667e0db98de12f8eb /src
parent8ec92863f13061c3dd2d56376eddfe258915589f (diff)
GStreamer: Prevent calling CameraBinSession::setStateHelper twice
Since CameraBinSession::setStateHelper() is supposed to handle only pending states, added a fix to prevent calling it twice. Otherwise CameraBinSession::load() can be called few times which might lead an error from gstreamer. Possible call stack: CameraBinSession::setState() CameraBinSession::setStateHelper() CameraBinSession::load() CameraBinSession::setStatus() CameraBinSession::setStateHelper() CameraBinSession::load() << gst_element_set_state is called also twice Task-number: QTBUG-53204 Change-Id: I00c66f91cd3b885c70848245da725ff68943fad2 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 4941c6ef..f06d95ea 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -729,18 +729,21 @@ void CameraBinSession::setState(QCamera::State newState)
if (newState == m_pendingState)
return;
- m_pendingState = newState;
- emit pendingStateChanged(m_pendingState);
+ emit pendingStateChanged(newState);
#if CAMERABIN_DEBUG
qDebug() << Q_FUNC_INFO << newState;
#endif
setStateHelper(newState);
+ m_pendingState = newState;
}
void CameraBinSession::setStateHelper(QCamera::State state)
{
+ if (state == m_pendingState)
+ return;
+
switch (state) {
case QCamera::UnloadedState:
unload();