summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backends/meta-logical-monitor.c14
-rw-r--r--src/backends/meta-monitor.c22
-rw-r--r--src/backends/meta-output.c16
3 files changed, 42 insertions, 10 deletions
diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c
index 9e14d660d..bc91d1d06 100644
--- a/src/backends/meta-logical-monitor.c
+++ b/src/backends/meta-logical-monitor.c
@@ -144,7 +144,7 @@ meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
is_presentation = logical_monitor->is_presentation;
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
- monitor);
+ g_object_ref (monitor));
for (l = logical_monitor->monitors; l; l = l->next)
{
@@ -255,13 +255,17 @@ meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
}
static void
-meta_logical_monitor_finalize (GObject *object)
+meta_logical_monitor_dispose (GObject *object)
{
MetaLogicalMonitor *logical_monitor = META_LOGICAL_MONITOR (object);
- g_list_free (logical_monitor->monitors);
+ if (logical_monitor->monitors)
+ {
+ g_list_free_full (logical_monitor->monitors, g_object_unref);
+ logical_monitor->monitors = NULL;
+ }
- G_OBJECT_CLASS (meta_logical_monitor_parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_logical_monitor_parent_class)->dispose (object);
}
static void
@@ -269,7 +273,7 @@ meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = meta_logical_monitor_finalize;
+ object_class->dispose = meta_logical_monitor_dispose;
}
gboolean
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 1e1af3950..98330661e 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -388,6 +388,21 @@ meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor,
}
static void
+meta_monitor_dispose (GObject *object)
+{
+ MetaMonitor *monitor = META_MONITOR (object);
+ MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
+
+ if (priv->outputs)
+ {
+ g_list_free_full (priv->outputs, g_object_unref);
+ priv->outputs = NULL;
+ }
+
+ G_OBJECT_CLASS (meta_monitor_parent_class)->dispose (object);
+}
+
+static void
meta_monitor_finalize (GObject *object)
{
MetaMonitor *monitor = META_MONITOR (object);
@@ -395,7 +410,6 @@ meta_monitor_finalize (GObject *object)
g_hash_table_destroy (priv->mode_ids);
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
- g_clear_pointer (&priv->outputs, g_list_free);
meta_monitor_spec_free (priv->spec);
G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object);
@@ -414,6 +428,7 @@ meta_monitor_class_init (MetaMonitorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = meta_monitor_dispose;
object_class->finalize = meta_monitor_finalize;
}
@@ -550,7 +565,7 @@ meta_monitor_normal_new (MetaGpu *gpu,
monitor_priv->gpu = gpu;
- monitor_priv->outputs = g_list_append (NULL, output);
+ monitor_priv->outputs = g_list_append (NULL, g_object_ref (output));
monitor_priv->winsys_id = output->winsys_id;
meta_monitor_generate_spec (monitor);
@@ -665,7 +680,8 @@ add_tiled_monitor_outputs (MetaGpu *gpu,
g_warn_if_fail (output->subpixel_order ==
monitor_tiled->origin_output->subpixel_order);
- monitor_priv->outputs = g_list_append (monitor_priv->outputs, output);
+ monitor_priv->outputs = g_list_append (monitor_priv->outputs,
+ g_object_ref (output));
}
}
diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c
index b5ecccd2b..2139a17a3 100644
--- a/src/backends/meta-output.c
+++ b/src/backends/meta-output.c
@@ -43,7 +43,7 @@ meta_output_assign_crtc (MetaOutput *output,
g_assert (crtc);
- priv->crtc = crtc;
+ g_set_object (&priv->crtc, crtc);
}
void
@@ -51,7 +51,7 @@ meta_output_unassign_crtc (MetaOutput *output)
{
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
- priv->crtc = NULL;
+ g_clear_object (&priv->crtc);
}
MetaCrtc *
@@ -63,6 +63,17 @@ meta_output_get_assigned_crtc (MetaOutput *output)
}
static void
+meta_output_dispose (GObject *object)
+{
+ MetaOutput *output = META_OUTPUT (object);
+ MetaOutputPrivate *priv = meta_output_get_instance_private (output);
+
+ g_clear_object (&priv->crtc);
+
+ G_OBJECT_CLASS (meta_output_parent_class)->dispose (object);
+}
+
+static void
meta_output_finalize (GObject *object)
{
MetaOutput *output = META_OUTPUT (object);
@@ -91,5 +102,6 @@ meta_output_class_init (MetaOutputClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = meta_output_dispose;
object_class->finalize = meta_output_finalize;
}