diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:56:15 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:56:15 +0100 |
commit | 1542c122b3672fe83e027411ad2445772e2d0ed3 (patch) | |
tree | e535bc621bd7ffa9d5ce89e0d495df5d1c4ab6fd /app/wlib/gtklib/liststore.c | |
parent | 773810e6583142d7d15263e6481c42aebed6d7f1 (diff) | |
parent | d1a8285f818eb7e5c3d6a05709ea21a808490b8c (diff) |
Update upstream source from tag 'upstream/5.1.0'
Update to upstream version '5.1.0'
with Debian dir 93ca74b8b4602fce4c9c7740e0cfdde25f086673
Diffstat (limited to 'app/wlib/gtklib/liststore.c')
-rw-r--r-- | app/wlib/gtklib/liststore.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/app/wlib/gtklib/liststore.c b/app/wlib/gtklib/liststore.c index eb53ea7..820366a 100644 --- a/app/wlib/gtklib/liststore.c +++ b/app/wlib/gtklib/liststore.c @@ -110,7 +110,8 @@ wlibListStoreGetContext(GtkListStore *ls, int inx) /** - * Clear the list store + * Clear the list store. All data in the list store will be automatically + * free'd when the list store is cleared. * * \param listStore IN */ @@ -118,9 +119,18 @@ wlibListStoreGetContext(GtkListStore *ls, int inx) void wlibListStoreClear(GtkListStore *listStore) { + wListItem_p id_p; + int i = 0; + assert(listStore != NULL); - /** \todo this looks like a memory leak. should probably free the id's */ + id_p = wlibListStoreGetContext(listStore, i++); + + while (id_p) { + g_free(id_p); + id_p = wlibListStoreGetContext(listStore, i++); + } + gtk_list_store_clear(listStore); } @@ -190,7 +200,9 @@ wlibListStoreUpdateIter(GtkListStore *ls, GtkTreeIter *iter, char *labels) } /** - * Add a pixbuf to the list store + * Add a pixbuf to the list store. So pixbuf is unref'ed so it will be freed + * with the list store. + * * \param ls IN list store * \param iter IN position * \param pixbuf IN pixbuf to add @@ -200,6 +212,8 @@ void wlibListStoreSetPixbuf(GtkListStore *ls, GtkTreeIter *iter, GdkPixbuf *pixbuf) { gtk_list_store_set(ls, iter, LISTCOL_BITMAP, pixbuf, -1); + g_object_ref_sink(pixbuf); + g_object_unref(pixbuf); } /** * Add a row to the list store |