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
This commit is contained in:
parent
1acb1bb7e6
commit
1e01a55cdc
@ -605,8 +605,10 @@ meta_idle_monitor_remove_watch (MetaIdleMonitor *monitor,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (META_IS_IDLE_MONITOR (monitor));
|
g_return_if_fail (META_IS_IDLE_MONITOR (monitor));
|
||||||
|
|
||||||
|
g_object_ref (monitor);
|
||||||
g_hash_table_remove (monitor->watches,
|
g_hash_table_remove (monitor->watches,
|
||||||
GUINT_TO_POINTER (id));
|
GUINT_TO_POINTER (id));
|
||||||
|
g_object_unref (monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user