summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/pulse/pulse-backend.c10
-rw-r--r--backends/pulse/pulse-device.c9
-rw-r--r--backends/pulse/pulse-ext-stream.c12
-rw-r--r--backends/pulse/pulse-port-switch.c20
-rw-r--r--backends/pulse/pulse-sink.c2
-rw-r--r--backends/pulse/pulse-source.c2
6 files changed, 28 insertions, 27 deletions
diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c
index e1b7ed5..1a1cabc 100644
--- a/backends/pulse/pulse-backend.c
+++ b/backends/pulse/pulse-backend.c
@@ -762,7 +762,7 @@ on_connection_card_info (PulseConnection *connection,
g_hash_table_insert (pulse->priv->devices,
GUINT_TO_POINTER (info->index),
- device);
+ g_object_ref (device));
free_list_devices (pulse);
g_signal_emit_by_name (G_OBJECT (pulse),
@@ -814,7 +814,7 @@ on_connection_sink_info (PulseConnection *connection,
free_list_streams (pulse);
g_hash_table_insert (pulse->priv->sinks,
GUINT_TO_POINTER (info->index),
- stream);
+ g_object_ref (stream));
if (device != NULL) {
pulse_device_add_stream (device, stream);
@@ -932,7 +932,7 @@ on_connection_source_info (PulseConnection *connection,
free_list_streams (pulse);
g_hash_table_insert (pulse->priv->sources,
GUINT_TO_POINTER (info->index),
- stream);
+ g_object_ref (stream));
if (device != NULL) {
pulse_device_add_stream (device, stream);
@@ -1051,7 +1051,7 @@ on_connection_ext_stream_info (PulseConnection *connection,
free_list_ext_streams (pulse);
g_hash_table_insert (pulse->priv->ext_streams,
g_strdup (info->name),
- ext);
+ g_object_ref (ext));
g_signal_emit_by_name (G_OBJECT (pulse),
"stored-control-added",
@@ -1091,7 +1091,7 @@ on_connection_ext_stream_loaded (PulseConnection *connection, PulseBackend *puls
continue;
free_list_ext_streams (pulse);
- g_hash_table_remove (pulse->priv->ext_streams, (gconstpointer) name);
+ g_hash_table_iter_remove (&iter);
g_signal_emit_by_name (G_OBJECT (pulse),
"stored-control-removed",
diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c
index 5403712..9f33132 100644
--- a/backends/pulse/pulse-device.c
+++ b/backends/pulse/pulse-device.c
@@ -281,7 +281,10 @@ pulse_device_add_stream (PulseDevice *device, PulseStream *stream)
free_list_streams (device);
- g_hash_table_insert (device->priv->streams, g_strdup (name), stream);
+ g_hash_table_insert (device->priv->streams,
+ g_strdup (name),
+ g_object_ref (stream));
+
g_signal_emit_by_name (G_OBJECT (device),
"stream-added",
name);
@@ -382,7 +385,9 @@ pulse_device_load (PulseDevice *device, const pa_card_info *info)
icon,
info->ports[i]->priority);
- g_hash_table_insert (device->priv->ports, g_strdup (name), port);
+ g_hash_table_insert (device->priv->ports,
+ g_strdup (name),
+ g_object_ref (port));
}
#endif
diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c
index 3e7490a..5d2ec75 100644
--- a/backends/pulse/pulse-ext-stream.c
+++ b/backends/pulse/pulse-ext-stream.c
@@ -274,7 +274,7 @@ pulse_ext_stream_set_stream (MateMixerStreamControl *mmsc, MateMixerStream *mms)
g_return_val_if_fail (PULSE_IS_EXT_STREAM (mmsc), FALSE);
g_return_val_if_fail (mms == NULL || PULSE_IS_STREAM (mms), FALSE);
- fill_ext_stream_restore_info (PULSE_STREAM_CONTROL (mms), &info);
+ fill_ext_stream_restore_info (PULSE_STREAM_CONTROL (mmsc), &info);
if (mms != NULL)
info.device = mate_mixer_stream_get_name (mms);
@@ -331,10 +331,16 @@ fill_ext_stream_restore_info (PulseStreamControl *control,
info->mute = mate_mixer_stream_control_get_mute (mmsc);
map = pulse_stream_control_get_channel_map (control);
- info->channel_map = *map;
+ if G_LIKELY (map != NULL)
+ info->channel_map = *map;
+ else
+ pa_channel_map_init (&info->channel_map);
cvolume = pulse_stream_control_get_cvolume (control);
- info->volume = *cvolume;
+ if G_LIKELY (cvolume != NULL)
+ info->volume = *cvolume;
+ else
+ pa_cvolume_init (&info->volume);
stream = mate_mixer_stream_control_get_stream (mmsc);
if (stream != NULL)
diff --git a/backends/pulse/pulse-port-switch.c b/backends/pulse/pulse-port-switch.c
index 08f1543..db06a7c 100644
--- a/backends/pulse/pulse-port-switch.c
+++ b/backends/pulse/pulse-port-switch.c
@@ -53,7 +53,6 @@ static void pulse_port_switch_set_property (GObject *object,
GParamSpec *pspec);
static void pulse_port_switch_init (PulsePortSwitch *swtch);
-static void pulse_port_switch_dispose (GObject *object);
G_DEFINE_ABSTRACT_TYPE (PulsePortSwitch, pulse_port_switch, MATE_MIXER_TYPE_SWITCH)
@@ -74,7 +73,6 @@ pulse_port_switch_class_init (PulsePortSwitchClass *klass)
MateMixerSwitchClass *switch_class;
object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = pulse_port_switch_dispose;
object_class->get_property = pulse_port_switch_get_property;
object_class->set_property = pulse_port_switch_set_property;
@@ -129,7 +127,11 @@ pulse_port_switch_set_property (GObject *object,
switch (param_id) {
case PROP_STREAM:
/* Construct-only object */
- swtch->priv->stream = g_value_dup_object (value);
+ swtch->priv->stream = g_value_get_object (value);
+
+ if (swtch->priv->stream != NULL)
+ g_object_add_weak_pointer (G_OBJECT (swtch->priv->stream),
+ (gpointer *) &swtch->priv->stream);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -145,18 +147,6 @@ pulse_port_switch_init (PulsePortSwitch *swtch)
PulsePortSwitchPrivate);
}
-static void
-pulse_port_switch_dispose (GObject *object)
-{
- PulsePortSwitch *swtch;
-
- swtch = PULSE_PORT_SWITCH (object);
-
- g_clear_object (&swtch->priv->stream);
-
- G_OBJECT_CLASS (pulse_port_switch_parent_class)->dispose (object);
-}
-
PulseStream *
pulse_port_switch_get_stream (PulsePortSwitch *swtch)
{
diff --git a/backends/pulse/pulse-sink.c b/backends/pulse/pulse-sink.c
index d2f0280..aedd5c8 100644
--- a/backends/pulse/pulse-sink.c
+++ b/backends/pulse/pulse-sink.c
@@ -188,7 +188,7 @@ pulse_sink_add_input (PulseSink *sink, const pa_sink_input_info *info)
input = pulse_sink_input_new (sink, info);
g_hash_table_insert (sink->priv->inputs,
GINT_TO_POINTER (info->index),
- input);
+ g_object_ref (input));
name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (input));
g_signal_emit_by_name (G_OBJECT (sink),
diff --git a/backends/pulse/pulse-source.c b/backends/pulse/pulse-source.c
index 0d095a7..99c7432 100644
--- a/backends/pulse/pulse-source.c
+++ b/backends/pulse/pulse-source.c
@@ -183,7 +183,7 @@ pulse_source_add_output (PulseSource *source, const pa_source_output_info *info)
output = pulse_source_output_new (source, info);
g_hash_table_insert (source->priv->outputs,
GINT_TO_POINTER (info->index),
- output);
+ g_object_ref (output));
name = mate_mixer_stream_control_get_name (MATE_MIXER_STREAM_CONTROL (output));
g_signal_emit_by_name (G_OBJECT (source),