[PATCH 3/5] info.c: add a method to clear all GtkListStore allocations

Lubomir I. Ivanov neolit123 at gmail.com
Wed Feb 20 17:07:20 PST 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

Add a new method in info.c called info_widget_destroy(), which
clears all GtkListStore instances. The method is exposed via
display-gtk.h and called from gtk-gui.c:on_destroy().

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 display-gtk.h | 1 +
 gtk-gui.c     | 1 +
 info.c        | 8 ++++++++
 3 files changed, 10 insertions(+)

diff --git a/display-gtk.h b/display-gtk.h
index 287a3e2..335cf49 100644
--- a/display-gtk.h
+++ b/display-gtk.h
@@ -64,6 +64,7 @@ extern GtkWidget *total_stats_widget(void);
 
 extern GtkWidget *dive_list_create(void);
 extern void dive_list_destroy(void);
+extern void info_widget_destroy(void);
 extern GdkPixbuf *get_gps_icon(void);
 
 /* Helper functions for gtk combo boxes */
diff --git a/gtk-gui.c b/gtk-gui.c
index f34393c..4120714 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -336,6 +336,7 @@ gboolean on_delete(GtkWidget* w, gpointer data)
 static void on_destroy(GtkWidget* w, gpointer data)
 {
 	dive_list_destroy();
+	info_widget_destroy();
 	gtk_main_quit();
 }
 
diff --git a/info.c b/info.c
index 46b3708..2fe6e47 100644
--- a/info.c
+++ b/info.c
@@ -1261,3 +1261,11 @@ GtkWidget *extended_dive_info_widget(void)
 	notes = text_view(vbox, _("Notes"), READ_ONLY);
 	return vbox;
 }
+
+void info_widget_destroy(void)
+{
+	g_object_unref(people_list);
+	g_object_unref(location_list);
+	g_object_unref(star_list);
+	g_object_unref(suit_list);
+}
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list