[mutter/wayland] core: prevent early MetaIdleMonitor destruction when its invoker vanishes
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] core: prevent early MetaIdleMonitor destruction when its invoker vanishes
- Date: Mon, 24 Feb 2014 10:57:50 +0000 (UTC)
commit bcd5446cdc981e6aaddfe659dad1f7341bc91c54
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Feb 22 20:16:28 2014 +0100
core: prevent early MetaIdleMonitor destruction when its invoker vanishes
If the last reference of a MetaIdleMonitor is held by the caller, it may
happen that the last reference is lost when calling the GDestroyNotify,
if this happens when the watched DBus name vanishes, the object (and the
watches hashtable) are destroyed while manipulating the watches hashtable,
so bad things may happen then.
Fix this by wrapping the operation by a ref/unref pair, so the object would
be destroyed after operating on the hashtable.
https://bugzilla.gnome.org/show_bug.cgi?id=724969
src/core/meta-idle-monitor.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/core/meta-idle-monitor.c b/src/core/meta-idle-monitor.c
index c99fc10..4f853ea 100644
--- a/src/core/meta-idle-monitor.c
+++ b/src/core/meta-idle-monitor.c
@@ -653,8 +653,10 @@ meta_idle_monitor_remove_watch (MetaIdleMonitor *monitor,
{
g_return_if_fail (META_IS_IDLE_MONITOR (monitor));
+ g_object_ref (monitor);
g_hash_table_remove (monitor->watches,
GUINT_TO_POINTER (id));
+ g_object_unref (monitor);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]