Commit 57c784bb authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

backends: add logical monitor -> monitor -> output -> crtc ref chain

Based on mutter commit:
mutter@768ec15e
parent 11d9e0d4
......@@ -96,15 +96,19 @@ derive_monitor_transform (GfMonitor *monitor)
}
static void
gf_logical_monitor_finalize (GObject *object)
gf_logical_monitor_dispose (GObject *object)
{
GfLogicalMonitor *logical_monitor;
logical_monitor = GF_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 (gf_logical_monitor_parent_class)->finalize (object);
G_OBJECT_CLASS (gf_logical_monitor_parent_class)->dispose (object);
}
static void
......@@ -114,7 +118,7 @@ gf_logical_monitor_class_init (GfLogicalMonitorClass *logical_monitor_class)
object_class = G_OBJECT_CLASS (logical_monitor_class);
object_class->finalize = gf_logical_monitor_finalize;
object_class->dispose = gf_logical_monitor_dispose;
}
static void
......@@ -194,7 +198,8 @@ gf_logical_monitor_add_monitor (GfLogicalMonitor *logical_monitor,
GList *l;
is_presentation = logical_monitor->is_presentation;
logical_monitor->monitors = g_list_append (logical_monitor->monitors, monitor);
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
g_object_ref (monitor));
for (l = logical_monitor->monitors; l; l = l->next)
{
......
......@@ -248,6 +248,24 @@ out:
return best_scale;
}
static void
gf_monitor_dispose (GObject *object)
{
GfMonitor *monitor;
GfMonitorPrivate *priv;
monitor = GF_MONITOR (object);
priv = gf_monitor_get_instance_private (monitor);
if (priv->outputs)
{
g_list_free_full (priv->outputs, g_object_unref);
priv->outputs = NULL;
}
G_OBJECT_CLASS (gf_monitor_parent_class)->dispose (object);
}
static void
gf_monitor_finalize (GObject *object)
{
......@@ -259,7 +277,6 @@ gf_monitor_finalize (GObject *object)
g_hash_table_destroy (priv->mode_ids);
g_list_free_full (priv->modes, (GDestroyNotify) gf_monitor_mode_free);
g_clear_pointer (&priv->outputs, g_list_free);
gf_monitor_spec_free (priv->spec);
G_OBJECT_CLASS (gf_monitor_parent_class)->finalize (object);
......@@ -336,6 +353,7 @@ gf_monitor_class_init (GfMonitorClass *monitor_class)
object_class = G_OBJECT_CLASS (monitor_class);
object_class->dispose = gf_monitor_dispose;
object_class->finalize = gf_monitor_finalize;
object_class->get_property = gf_monitor_get_property;
object_class->set_property = gf_monitor_set_property;
......@@ -401,7 +419,7 @@ gf_monitor_append_output (GfMonitor *monitor,
priv = gf_monitor_get_instance_private (monitor);
priv->outputs = g_list_append (priv->outputs, output);
priv->outputs = g_list_append (priv->outputs, g_object_ref (output));
}
void
......
......@@ -38,6 +38,20 @@ typedef struct
G_DEFINE_TYPE_WITH_PRIVATE (GfOutput, gf_output, G_TYPE_OBJECT)
static void
gf_output_dispose (GObject *object)
{
GfOutput *output;
GfOutputPrivate *priv;
output = GF_OUTPUT (object);
priv = gf_output_get_instance_private (output);
g_clear_object (&priv->crtc);
G_OBJECT_CLASS (gf_output_parent_class)->dispose (object);
}
static void
gf_output_finalize (GObject *object)
{
......@@ -66,6 +80,7 @@ gf_output_class_init (GfOutputClass *output_class)
object_class = G_OBJECT_CLASS (output_class);
object_class->dispose = gf_output_dispose;
object_class->finalize = gf_output_finalize;
}
......@@ -90,7 +105,7 @@ gf_output_assign_crtc (GfOutput *output,
g_assert (crtc);
priv->crtc = crtc;
g_set_object (&priv->crtc, crtc);
}
void
......@@ -100,7 +115,7 @@ gf_output_unassign_crtc (GfOutput *output)
priv = gf_output_get_instance_private (output);
priv->crtc = NULL;
g_clear_object (&priv->crtc);
}
GfCrtc *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment