Skip to content

Commit

Permalink
frontend-tools: Fix multiple signal-slot connections on Output Timer
Browse files Browse the repository at this point in the history
When running an Output Timer multiple times, multiple signal-slot
connections would be made with the corresponding output stop event
functions. This would cause later Output Timers to terminate
unexpectedly early, due to the stop functions having been called
repeatedly on previous Output Timer runs while outputs were stopping.

There may still be an underlying bug with calling stop on outputs
repeatedly, but this change at least ensures that Output Timers only
call their stop functions once.
  • Loading branch information
matt818 authored and RytoEX committed Nov 20, 2023
1 parent cfd8d4c commit 93f5b45
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions UI/frontend-plugins/frontend-tools/output-timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ OutputTimer::OutputTimer(QWidget *parent)

recordingTimer = new QTimer(this);
recordingTimerDisplay = new QTimer(this);

QObject::connect(streamingTimer, &QTimer::timeout, this,
&OutputTimer::EventStopStreaming);
QObject::connect(streamingTimerDisplay, &QTimer::timeout, this,
&OutputTimer::UpdateStreamTimerDisplay);
QObject::connect(recordingTimer, &QTimer::timeout, this,
&OutputTimer::EventStopRecording);
QObject::connect(recordingTimerDisplay, &QTimer::timeout, this,
&OutputTimer::UpdateRecordTimerDisplay);
}

void OutputTimer::closeEvent(QCloseEvent *)
Expand Down Expand Up @@ -86,12 +95,6 @@ void OutputTimer::StreamTimerStart()
streamingTimer->setInterval(total);
streamingTimer->setSingleShot(true);

QObject::connect(streamingTimer, &QTimer::timeout, this,
&OutputTimer::EventStopStreaming);

QObject::connect(streamingTimerDisplay, &QTimer::timeout, this,
&OutputTimer::UpdateStreamTimerDisplay);

streamingTimer->start();
streamingTimerDisplay->start(1000);
ui->outputTimerStream->setText(obs_module_text("Stop"));
Expand Down Expand Up @@ -120,12 +123,6 @@ void OutputTimer::RecordTimerStart()
recordingTimer->setInterval(total);
recordingTimer->setSingleShot(true);

QObject::connect(recordingTimer, &QTimer::timeout, this,
&OutputTimer::EventStopRecording);

QObject::connect(recordingTimerDisplay, &QTimer::timeout, this,
&OutputTimer::UpdateRecordTimerDisplay);

recordingTimer->start();
recordingTimerDisplay->start(1000);
ui->outputTimerRecord->setText(obs_module_text("Stop"));
Expand Down

0 comments on commit 93f5b45

Please sign in to comment.