[folks] core: Unprepare all backends when destroying the BackendStore
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Unprepare all backends when destroying the BackendStore
- Date: Sun, 16 Feb 2014 23:53:57 +0000 (UTC)
commit 9064888b65eff3d30023bffebe5fa042a8e0369b
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Nov 13 16:08:08 2013 +0000
core: Unprepare all backends when destroying the BackendStore
This helps free up some reference cycles (particularly in the BlueZ
backend) and hence ensure no memory is leaked.
https://bugzilla.gnome.org/show_bug.cgi?id=712274
folks/backend-store.vala | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index 4af4d20..e2ec287 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -158,6 +158,16 @@ public class Folks.BackendStore : Object {
~BackendStore ()
{
+ /* Unprepare all existing backends. */
+ var iter = this._prepared_backends.map_iterator ();
+ while (iter.next () == true)
+ {
+ var backend = iter.get_value ();
+ backend.unprepare.begin ();
+ }
+
+ this._prepared_backends.clear ();
+
/* Finalize all the loaded modules that have finalize functions */
foreach (var module in this._modules.values)
{
@@ -169,6 +179,8 @@ public class Folks.BackendStore : Object {
}
}
+ this._modules.clear ();
+
/* Disconnect from the debug handler */
this._debug.print_status.disconnect (this._debug_print_status);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]