[gnome-flashback] monitor: unset output monitor when disposing
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] monitor: unset output monitor when disposing
- Date: Sat, 13 Aug 2022 20:32:07 +0000 (UTC)
commit a955cbcb34f4aed64380acc59c1b54633124c256
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Aug 13 13:35:36 2022 +0300
monitor: unset output monitor when disposing
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/-/commit/47a67252078ba5c78ec5
backends/gf-monitor-manager.c | 13 ++++++++++++-
backends/gf-monitor.c | 12 ++++++++++++
backends/gf-output-private.h | 2 ++
backends/gf-output.c | 12 ++++++++++++
4 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 5b5c087..5a54095 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1208,6 +1208,17 @@ is_main_tiled_monitor_output (GfOutput *output)
output_info->tile_info.loc_v_tile == 0);
}
+static void
+destroy_monitor (gpointer data)
+{
+ GfMonitor *monitor;
+
+ monitor = GF_MONITOR (data);
+
+ g_object_run_dispose (G_OBJECT (monitor));
+ g_object_unref (monitor);
+}
+
static void
rebuild_monitors (GfMonitorManager *manager)
{
@@ -1219,7 +1230,7 @@ rebuild_monitors (GfMonitorManager *manager)
if (manager->monitors)
{
- g_list_free_full (manager->monitors, g_object_unref);
+ g_list_free_full (manager->monitors, destroy_monitor);
manager->monitors = NULL;
}
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index 459ad1b..a8dcfbc 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -377,6 +377,17 @@ get_closest_scale_factor_for_resolution (float width,
return best_scale;
}
+static void
+unset_monitor (gpointer data,
+ gpointer user_data)
+{
+ GfOutput *output;
+
+ output = GF_OUTPUT (data);
+
+ gf_output_unset_monitor (output);
+}
+
static void
gf_monitor_dispose (GObject *object)
{
@@ -388,6 +399,7 @@ gf_monitor_dispose (GObject *object)
if (priv->outputs)
{
+ g_list_foreach (priv->outputs, unset_monitor, NULL);
g_list_free_full (priv->outputs, g_object_unref);
priv->outputs = NULL;
}
diff --git a/backends/gf-output-private.h b/backends/gf-output-private.h
index c7c45eb..e59cdd4 100644
--- a/backends/gf-output-private.h
+++ b/backends/gf-output-private.h
@@ -66,6 +66,8 @@ GfMonitor *gf_output_get_monitor (GfOutput
void gf_output_set_monitor (GfOutput *self,
GfMonitor *monitor);
+void gf_output_unset_monitor (GfOutput *self);
+
const char *gf_output_get_name (GfOutput *self);
void gf_output_assign_crtc (GfOutput *self,
diff --git a/backends/gf-output.c b/backends/gf-output.c
index b5c659b..9a950b2 100644
--- a/backends/gf-output.c
+++ b/backends/gf-output.c
@@ -269,6 +269,18 @@ gf_output_set_monitor (GfOutput *self,
priv->monitor = monitor;
}
+void
+gf_output_unset_monitor (GfOutput *self)
+{
+ GfOutputPrivate *priv;
+
+ priv = gf_output_get_instance_private (self);
+
+ g_warn_if_fail (priv->monitor);
+
+ priv->monitor = NULL;
+}
+
const char *
gf_output_get_name (GfOutput *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]