From ba76ed7d519a45b7f9b331a28e0617b919c9805e Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 25 Sep 2020 14:04:31 -0400
Subject: [PATCH 3/4] barriers: Free backend implementation at dispose time
When a MetaBarrier is first created it allocates a backend
impl object which does the actual heavy lifting.
Unfortunately, that backend object is never freed.
This commit ensures the implementation gets freed when
the barrier object is freed.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1451
---
src/backends/meta-barrier.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/backends/meta-barrier.c b/src/backends/meta-barrier.c
index 2353ef150..65abf7cab 100644
--- a/src/backends/meta-barrier.c
+++ b/src/backends/meta-barrier.c
@@ -94,67 +94,70 @@ meta_barrier_set_property (GObject *object,
{
case PROP_DISPLAY:
priv->display = g_value_get_object (value);
break;
case PROP_X1:
priv->border.line.a.x = g_value_get_int (value);
break;
case PROP_Y1:
priv->border.line.a.y = g_value_get_int (value);
break;
case PROP_X2:
priv->border.line.b.x = g_value_get_int (value);
break;
case PROP_Y2:
priv->border.line.b.y = g_value_get_int (value);
break;
case PROP_DIRECTIONS:
meta_border_set_allows_directions (&priv->border,
g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_barrier_dispose (GObject *object)
{
MetaBarrier *barrier = META_BARRIER (object);
+ MetaBarrierPrivate *priv = barrier->priv;
if (meta_barrier_is_active (barrier))
{
meta_bug ("MetaBarrier %p was destroyed while it was still active.",
barrier);
}
+ g_clear_object (&priv->impl);
+
G_OBJECT_CLASS (meta_barrier_parent_class)->dispose (object);
}
gboolean
meta_barrier_is_active (MetaBarrier *barrier)
{
MetaBarrierImpl *impl = barrier->priv->impl;
if (impl)
return META_BARRIER_IMPL_GET_CLASS (impl)->is_active (impl);
else
return FALSE;
}
/**
* meta_barrier_release:
* @barrier: The barrier to release
* @event: The event to release the pointer for
*
* In XI2.3, pointer barriers provide a feature where they can
* be temporarily released so that the pointer goes through
* them. Pass a #MetaBarrierEvent to release the barrier for
* this event sequence.
*/
void
meta_barrier_release (MetaBarrier *barrier,
MetaBarrierEvent *event)
{
MetaBarrierImpl *impl = barrier->priv->impl;
--
2.26.2