mixer-control: Fix a few oversights with signal connections

We should disconnect the signal handlers in all cases when the sink and source
disappears or is replaced.
This commit is contained in:
Jonas Dreßler 2024-02-29 23:51:22 +01:00
parent 10a3c0a766
commit 91f3f41490

View File

@ -963,6 +963,13 @@ _set_default_source (GvcMixerControl *control,
guint new_id;
if (stream == NULL) {
if (!control->priv->default_source_is_set)
return;
g_signal_handlers_disconnect_by_func (gvc_mixer_control_get_default_source (control),
on_default_source_port_notify,
control);
control->priv->default_source_id = 0;
control->priv->default_source_is_set = FALSE;
g_signal_emit (control,
@ -976,12 +983,6 @@ _set_default_source (GvcMixerControl *control,
if (control->priv->default_source_id != new_id) {
GvcMixerUIDevice *input;
control->priv->default_source_id = new_id;
control->priv->default_source_is_set = TRUE;
g_signal_emit (control,
signals[DEFAULT_SOURCE_CHANGED],
0,
new_id);
if (control->priv->default_source_is_set) {
g_signal_handlers_disconnect_by_func (gvc_mixer_control_get_default_source (control),
@ -994,6 +995,13 @@ _set_default_source (GvcMixerControl *control,
G_CALLBACK (on_default_source_port_notify),
control);
control->priv->default_source_id = new_id;
control->priv->default_source_is_set = TRUE;
g_signal_emit (control,
signals[DEFAULT_SOURCE_CHANGED],
0,
new_id);
input = gvc_mixer_control_lookup_device_from_stream (control, stream);
g_signal_emit (G_OBJECT (control),
@ -1038,6 +1046,11 @@ _set_default_sink (GvcMixerControl *control,
* sink if it's already unset */
if (control->priv->default_sink_is_set == FALSE)
return;
g_signal_handlers_disconnect_by_func (gvc_mixer_control_get_default_sink (control),
on_default_sink_port_notify,
control);
control->priv->default_sink_id = 0;
control->priv->default_sink_is_set = FALSE;
g_signal_emit (control,