[mutter] core: prevent early MetaIdleMonitor destruction when its invoker vanishes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] core: prevent early MetaIdleMonitor destruction when its invoker vanishes
- Date: Sun, 23 Feb 2014 01:08:33 +0000 (UTC)
commit 1e01a55cdcb9b57bfd041806ceb925309f6cdeb9
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 eda9289..edc3c61 100644
--- a/src/core/meta-idle-monitor.c
+++ b/src/core/meta-idle-monitor.c
@@ -605,8 +605,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]