summaryrefslogtreecommitdiff
path: root/libmatemixer
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-08-20 18:53:26 +0200
committerMichal Ratajsky <[email protected]>2014-08-20 18:53:26 +0200
commit0325b6223a23ebd75fbd8c9244baab00facec126 (patch)
tree8547bdc4a9e875d931eddbeb81e34ec37ddfbfef /libmatemixer
parent9956b2a9465c538c8792235c1ee02d2f90b84641 (diff)
downloadlibmatemixer-0325b6223a23ebd75fbd8c9244baab00facec126.tar.bz2
libmatemixer-0325b6223a23ebd75fbd8c9244baab00facec126.tar.xz
Fix some refcounting and stream control parent setting issues
Diffstat (limited to 'libmatemixer')
-rw-r--r--libmatemixer/matemixer-stream-control.c30
-rw-r--r--libmatemixer/matemixer-stream.c3
2 files changed, 10 insertions, 23 deletions
diff --git a/libmatemixer/matemixer-stream-control.c b/libmatemixer/matemixer-stream-control.c
index 80f9559..1137da8 100644
--- a/libmatemixer/matemixer-stream-control.c
+++ b/libmatemixer/matemixer-stream-control.c
@@ -78,7 +78,6 @@ static void mate_mixer_stream_control_set_property (GObject
GParamSpec *pspec);
static void mate_mixer_stream_control_init (MateMixerStreamControl *control);
-static void mate_mixer_stream_control_dispose (GObject *object);
static void mate_mixer_stream_control_finalize (GObject *object);
G_DEFINE_ABSTRACT_TYPE (MateMixerStreamControl, mate_mixer_stream_control, G_TYPE_OBJECT)
@@ -89,7 +88,6 @@ mate_mixer_stream_control_class_init (MateMixerStreamControlClass *klass)
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = mate_mixer_stream_control_dispose;
object_class->finalize = mate_mixer_stream_control_finalize;
object_class->get_property = mate_mixer_stream_control_get_property;
object_class->set_property = mate_mixer_stream_control_set_property;
@@ -274,10 +272,9 @@ mate_mixer_stream_control_set_property (GObject *object,
/* Construct-only object */
control->priv->stream = g_value_get_object (value);
- if (control->priv->stream != NULL) {
+ if (control->priv->stream != NULL)
g_object_add_weak_pointer (G_OBJECT (control->priv->stream),
(gpointer *) &control->priv->stream);
- }
break;
default:
@@ -295,18 +292,6 @@ mate_mixer_stream_control_init (MateMixerStreamControl *control)
}
static void
-mate_mixer_stream_control_dispose (GObject *object)
-{
- MateMixerStreamControl *control;
-
- control = MATE_MIXER_STREAM_CONTROL (object);
-
- g_clear_object (&control->priv->stream);
-
- G_OBJECT_CLASS (mate_mixer_stream_control_parent_class)->dispose (object);
-}
-
-static void
mate_mixer_stream_control_finalize (GObject *object)
{
MateMixerStreamControl *control;
@@ -923,11 +908,14 @@ _mate_mixer_stream_control_set_stream (MateMixerStreamControl *control,
return;
if (control->priv->stream != NULL)
- g_object_unref (control->priv->stream);
-
- if (stream != NULL)
- control->priv->stream = g_object_ref (stream);
- else
+ g_object_remove_weak_pointer (G_OBJECT (control->priv->stream),
+ (gpointer *) &control->priv->stream);
+
+ if (stream != NULL) {
+ control->priv->stream = stream;
+ g_object_add_weak_pointer (G_OBJECT (control->priv->stream),
+ (gpointer *) &control->priv->stream);
+ } else
control->priv->stream = NULL;
g_object_notify_by_pspec (G_OBJECT (control), properties[PROP_STREAM]);
diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c
index 03902bd..aa1afd7 100644
--- a/libmatemixer/matemixer-stream.c
+++ b/libmatemixer/matemixer-stream.c
@@ -257,10 +257,9 @@ mate_mixer_stream_set_property (GObject *object,
/* Construct-only object */
stream->priv->device = g_value_get_object (value);
- if (stream->priv->device != NULL) {
+ if (stream->priv->device != NULL)
g_object_add_weak_pointer (G_OBJECT (stream->priv->device),
(gpointer *) &stream->priv->device);
- }
break;
case PROP_DEFAULT_CONTROL:
/* Construct-only object */