diff --git a/UI/volume-control.cpp b/UI/volume-control.cpp index f8ebff1dc..e4b6125e4 100644 --- a/UI/volume-control.cpp +++ b/UI/volume-control.cpp @@ -379,14 +379,13 @@ VolControl::VolControl(OBSSource source_, bool showConfig, bool vertical) obs_fader_add_callback(obs_fader, OBSVolumeChanged, this); obs_volmeter_add_callback(obs_volmeter, OBSVolumeLevel, this); - signal_handler_connect(obs_source_get_signal_handler(source), "mute", - OBSVolumeMuted, this); - signal_handler_connect(obs_source_get_signal_handler(source), - "audio_mixers", OBSMixersOrMonitoringChanged, - this); - signal_handler_connect(obs_source_get_signal_handler(source), - "audio_monitoring", OBSMixersOrMonitoringChanged, - this); + sigs.emplace_back(obs_source_get_signal_handler(source), "mute", + OBSVolumeMuted, this); + sigs.emplace_back(obs_source_get_signal_handler(source), "audio_mixers", + OBSMixersOrMonitoringChanged, this); + sigs.emplace_back(obs_source_get_signal_handler(source), + "audio_monitoring", OBSMixersOrMonitoringChanged, + this); QWidget::connect(slider, &VolumeSlider::valueChanged, this, &VolControl::SliderChanged); @@ -422,14 +421,7 @@ VolControl::~VolControl() obs_fader_remove_callback(obs_fader, OBSVolumeChanged, this); obs_volmeter_remove_callback(obs_volmeter, OBSVolumeLevel, this); - signal_handler_disconnect(obs_source_get_signal_handler(source), "mute", - OBSVolumeMuted, this); - signal_handler_disconnect(obs_source_get_signal_handler(source), - "audio_mixers", OBSMixersOrMonitoringChanged, - this); - signal_handler_disconnect(obs_source_get_signal_handler(source), - "audio_monitoring", - OBSMixersOrMonitoringChanged, this); + sigs.clear(); if (contextMenu) contextMenu->close(); diff --git a/UI/volume-control.hpp b/UI/volume-control.hpp index 613add27f..ecc7b23f9 100644 --- a/UI/volume-control.hpp +++ b/UI/volume-control.hpp @@ -278,6 +278,7 @@ class VolControl : public QWidget { private: OBSSource source; + std::vector sigs; QLabel *nameLabel; QLabel *volLabel; VolumeMeter *volMeter;