From 95f7704d14c90d458f912dedb96008f50df45a86 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 11 Jun 2021 19:12:14 +0400 Subject: [PATCH] Fix crash in voice chat camera enabling. --- Telegram/SourceFiles/calls/group/calls_group_call.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index cc4f1e988..c67eadc99 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -1943,7 +1943,10 @@ void GroupCall::setupOutgoingVideo() { _cameraState.value( ) | rpl::combine_previous( - ) | rpl::start_with_next([=](VideoState previous, VideoState state) { + ) | rpl::filter([=](VideoState previous, VideoState state) { + // Recursive entrance may happen if error happens when activating. + return (previous != state); + }) | rpl::start_with_next([=](VideoState previous, VideoState state) { const auto wasPaused = (previous == VideoState::Paused); const auto wasActive = (previous != VideoState::Inactive); const auto nowPaused = (state == VideoState::Paused); @@ -1989,7 +1992,10 @@ void GroupCall::setupOutgoingVideo() { _screenState.value( ) | rpl::combine_previous( - ) | rpl::start_with_next([=](VideoState previous, VideoState state) { + ) | rpl::filter([=](VideoState previous, VideoState state) { + // Recursive entrance may happen if error happens when activating. + return (previous != state); + }) | rpl::start_with_next([=](VideoState previous, VideoState state) { const auto wasPaused = (previous == VideoState::Paused); const auto wasActive = (previous != VideoState::Inactive); const auto nowPaused = (state == VideoState::Paused);