UI: Fix potential crash when outputs change

If the service settings change and the output type changes, the previous
signals would attempt to disconnect after the output has been destroyed,
and subsequently that would cause a crash.
This commit is contained in:
jp9000 2017-07-25 19:01:29 -07:00
parent fd3791a57d
commit 960958a4ca

View File

@ -662,6 +662,11 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
/* XXX: this is messy and disgusting and should be refactored */
if (outputType != type) {
streamDelayStarting.Disconnect();
streamStopping.Disconnect();
startStreaming.Disconnect();
stopStreaming.Disconnect();
streamOutput = obs_output_create(type, "simple_stream",
nullptr, nullptr);
if (!streamOutput)
@ -1349,6 +1354,11 @@ bool AdvancedOutput::StartStreaming(obs_service_t *service)
/* XXX: this is messy and disgusting and should be refactored */
if (outputType != type) {
streamDelayStarting.Disconnect();
streamStopping.Disconnect();
startStreaming.Disconnect();
stopStreaming.Disconnect();
streamOutput = obs_output_create(type, "adv_stream",
nullptr, nullptr);
if (!streamOutput)