[gnome-flashback] backends: add logical monitor -> monitor -> output -> crtc ref chain
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] backends: add logical monitor -> monitor -> output -> crtc ref chain
- Date: Thu, 18 Jul 2019 17:29:40 +0000 (UTC)
commit 57c784bb6d46e931123e970aa91fc7e73a277d4a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Jul 16 21:05:47 2019 +0300
backends: add logical monitor -> monitor -> output -> crtc ref chain
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/commit/768ec15ea072df21dd6c
backends/gf-logical-monitor.c | 15 ++++++++++-----
backends/gf-monitor.c | 22 ++++++++++++++++++++--
backends/gf-output.c | 19 +++++++++++++++++--
3 files changed, 47 insertions(+), 9 deletions(-)
---
diff --git a/backends/gf-logical-monitor.c b/backends/gf-logical-monitor.c
index dceb90e..09f55be 100644
--- a/backends/gf-logical-monitor.c
+++ b/backends/gf-logical-monitor.c
@@ -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)
{
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index 4efb53d..e3ad771 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -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
diff --git a/backends/gf-output.c b/backends/gf-output.c
index 9627914..f4a05af 100644
--- a/backends/gf-output.c
+++ b/backends/gf-output.c
@@ -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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]