[glade3/glade-3-8] * plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-column-types.[ch]: Added glade_column_type_new()
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3/glade-3-8] * plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-column-types.[ch]: Added glade_column_type_new()
- Date: Mon, 20 Dec 2010 07:49:20 +0000 (UTC)
commit 7f8dc0d8b65066b13c99941c86598cfbe4a0910b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Dec 20 16:51:41 2010 +0900
* plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-column-types.[ch]: Added
glade_column_type_new() to create a GladeColumnType struct properly using
g_slice_new0(). An occurance of allocating the struct with g_new0 was causing
Glade to crash when freeing the block with g_slice_free (bug 637563). Many
big thanks to Benjamin Otte for tracking down the problem.
ChangeLog | 8 ++++++++
plugins/gtk+/glade-column-types.c | 24 ++++++++++++++++--------
plugins/gtk+/glade-column-types.h | 2 ++
plugins/gtk+/glade-gtk.c | 4 +++-
4 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 26c88be..4dd7b4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-12-20 Tristan Van Berkom <tristanvb openismus com>
+
+ * plugins/gtk+/glade-gtk.c, plugins/gtk+/glade-column-types.[ch]: Added
+ glade_column_type_new() to create a GladeColumnType struct properly using
+ g_slice_new0(). An occurance of allocating the struct with g_new0 was causing
+ Glade to crash when freeing the block with g_slice_free (bug 637563). Many
+ big thanks to Benjamin Otte for tracking down the problem.
+
2010-12-19 Tristan Van Berkom <tristanvb openismus com>
* plugins/gtk+/glade-gtk.c: Fix alpha_sort_box_children() to give a consistent
diff --git a/plugins/gtk+/glade-column-types.c b/plugins/gtk+/glade-column-types.c
index 8b3b72b..91fffe1 100644
--- a/plugins/gtk+/glade-column-types.c
+++ b/plugins/gtk+/glade-column-types.c
@@ -145,18 +145,28 @@ glade_column_list_copy (GList *list)
for (l = list; l; l = g_list_next (l))
{
- GladeColumnType *new_data = g_slice_new0 (GladeColumnType);
GladeColumnType *data = l->data;
-
- new_data->type_name = g_strdup (data->type_name);
- new_data->column_name = g_strdup (data->column_name);
-
+ GladeColumnType *new_data =
+ glade_column_type_new (data->type_name, data->column_name);
+
retval = g_list_prepend (retval, new_data);
}
return g_list_reverse (retval);
}
+GladeColumnType *
+glade_column_type_new (const gchar *type_name,
+ const gchar *column_name)
+{
+ GladeColumnType *column = g_slice_new0 (GladeColumnType);
+
+ column->type_name = g_strdup (type_name);
+ column->column_name = g_strdup (column_name);
+
+ return column;
+}
+
void
glade_column_type_free (GladeColumnType *column)
{
@@ -323,9 +333,7 @@ eprop_column_append (GladeEditorProperty *eprop,
if (columns)
columns = glade_column_list_copy (columns);
- data = g_slice_new0 (GladeColumnType);
- data->column_name = g_strdup (column_name);
- data->type_name = g_strdup (type_name);
+ data = glade_column_type_new (type_name, column_name);
columns = g_list_append (columns, data);
diff --git a/plugins/gtk+/glade-column-types.h b/plugins/gtk+/glade-column-types.h
index f2c3fbc..1f818fe 100644
--- a/plugins/gtk+/glade-column-types.h
+++ b/plugins/gtk+/glade-column-types.h
@@ -41,6 +41,8 @@ GType glade_eprop_column_types_get_type (void) G_GNUC_CONST;
void glade_column_list_free (GList *list);
GList *glade_column_list_copy (GList *list);
+GladeColumnType *glade_column_type_new (const gchar *type_name,
+ const gchar *column_name);
void glade_column_type_free (GladeColumnType *column);
GladeColumnType *glade_column_list_find_column (GList *list, const gchar *column_name);
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 5bd512f..f949e66 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -10772,7 +10772,7 @@ glade_gtk_store_read_columns (GladeWidget *widget, GladeXmlNode *node)
for (prop = glade_xml_node_get_children_with_comments (columns_node); prop;
prop = glade_xml_node_next_with_comments (prop))
{
- GladeColumnType *data = g_new0 (GladeColumnType, 1);
+ GladeColumnType *data;
gchar *type, *comment_str, buffer[256];
if (!glade_xml_node_verify_silent (prop, GLADE_TAG_COLUMN) &&
@@ -10789,6 +10789,8 @@ glade_gtk_store_read_columns (GladeWidget *widget, GladeXmlNode *node)
}
type = glade_xml_get_property_string_required (prop, GLADE_TAG_TYPE, NULL);
+
+ data = glade_column_type_new (type, NULL);
data->type_name = g_strdup (type);
data->column_name = column_name[0] ? g_strdup (column_name) : g_ascii_strdown (type, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]