[balsa] address-book-config: Do not leak structures



commit 1bafa3661087d5d1dad8524a7181354f716fe937
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Jul 27 16:29:22 2019 -0400

    address-book-config: Do not leak structures
    
    * src/address-book-config.c (balsa_address_book_config_new),
      (balsa_address_book_config_new_from_type):

 ChangeLog                 | 7 +++++++
 src/address-book-config.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a24466c2..c7efb9710 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-07-27  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       address-book-config: Do not leak structures
+
+       * src/address-book-config.c (balsa_address_book_config_new),
+       (balsa_address_book_config_new_from_type):
+
 2019-07-27  Peter Bloomfield  <pbloomfield bellsouth net>
 
        mailbox-node: Do not give access to BalsaMailboxNode:scanned
diff --git a/src/address-book-config.c b/src/address-book-config.c
index 684c3f4e5..4c0a5cbe0 100644
--- a/src/address-book-config.c
+++ b/src/address-book-config.c
@@ -117,7 +117,7 @@ balsa_address_book_config_new(LibBalsaAddressBook * address_book,
     }
 
     abc = g_new0(AddressBookConfig, 1);
-    g_object_set_data(G_OBJECT(address_book), "balsa-abc", abc);
+    g_object_set_data_full(G_OBJECT(address_book), "balsa-abc", abc, g_free);
     abc->address_book = address_book;
     abc->callback = callback;
     abc->type = G_TYPE_FROM_INSTANCE(address_book);
@@ -141,6 +141,7 @@ balsa_address_book_config_new_from_type(GType type,
     abc->callback = callback;
     abc->type = type;
     abc->window = create_dialog_from_type(abc);
+    g_object_weak_ref(G_OBJECT(abc->window), (GWeakNotify) g_free, abc);
 
     gtk_widget_show_all(GTK_WIDGET(abc->window));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]