Commit 11b837ad authored by Guillaume Desmottes's avatar Guillaume Desmottes
Browse files

Persona: make sure to NULL-ify the individual when it's destroyed

https://bugzilla.gnome.org/show_bug.cgi?id=672381
parent 31e80344
......@@ -137,6 +137,14 @@ public abstract class Folks.Persona : Object
*/
public weak PersonaStore store { get; construct; }
private void _individual_weak_notify_cb (Object obj)
{
debug ("Individual %p has been destroyed; resetting the Individual of %s",
obj, this.iid);
this._individual = null;
this.notify_property ("individual");
}
/**
* The {@link Individual} which contains this Persona.
*
......@@ -160,6 +168,16 @@ public abstract class Folks.Persona : Object
{
assert (value == null || ((!) value).personas.contains (this));
if (this._individual != null)
{
this._individual.weak_unref (this._individual_weak_notify_cb);
}
if (value != null)
{
value.weak_ref (this._individual_weak_notify_cb);
}
this._individual = value;
}
}
......@@ -323,4 +341,9 @@ public abstract class Folks.Persona : Object
((string) ((char*) uid + backend_name_length +
persona_store_id_length + 2)));
}
~Persona ()
{
this.individual = null;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment