Commit 9caee039 authored by VaL Doroshchuk's avatar VaL Doroshchuk
Browse files

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: default avatarChristian Stromme <christian.stromme@qt.io>
Showing with 5 additions and 2 deletions
......@@ -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();
......
Supports Markdown
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