[glade3] * gladeui/glade-project.c: Fixed crasher on cross-project copy paste by reordering the sequence
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * gladeui/glade-project.c: Fixed crasher on cross-project copy paste by reordering the sequence
- Date: Sat, 15 May 2010 16:13:31 +0000 (UTC)
commit 2dd93a4be3a229496c6e26ea7416170e4e85b565
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat May 15 12:12:32 2010 -0400
* gladeui/glade-project.c: Fixed crasher on cross-project copy paste by reordering
the sequence of events in glade_project_add_object().
ChangeLog | 7 ++++++-
gladeui/glade-project.c | 35 ++++++++++++++++++++---------------
2 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 322961e..e7acf56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2010-04-14 Tristan Van Berkom <tvb gnome org>
+2010-05-15 Tristan Van Berkom <tvb gnome org>
+
+ * gladeui/glade-project.c: Fixed crasher on cross-project copy paste by reordering
+ the sequence of events in glade_project_add_object().
+
+2010-05-14 Tristan Van Berkom <tvb gnome org>
* configure.ac, NEWS: Rolling Glade 3.7.1
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index a280b38..a50f945 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2699,17 +2699,10 @@ glade_project_add_object (GladeProject *project,
}
glade_project_reserve_widget_name (project, gwidget, gwidget->name);
-
- if ((children = glade_widget_get_children (gwidget)) != NULL)
- {
- for (list = children; list && list->data; list = list->next)
- glade_project_add_object
- (project, old_project, G_OBJECT (list->data));
- g_list_free (children);
- }
glade_widget_set_project (gwidget, (gpointer)project);
g_object_ref (object);
+
if (glade_widget_get_parent (gwidget) == NULL)
{
project->priv->tree = g_list_insert_sorted (project->priv->tree, object,
@@ -2719,10 +2712,6 @@ glade_project_add_object (GladeProject *project,
/* Be sure to update the list before emitting signals */
project->priv->objects = g_list_prepend (project->priv->objects,
object);
-
- g_signal_emit (G_OBJECT (project),
- glade_project_signals [ADD_WIDGET],
- 0, gwidget);
if (!project->priv->loading)
{
@@ -2731,11 +2720,26 @@ glade_project_add_object (GladeProject *project,
gtk_tree_model_row_inserted (GTK_TREE_MODEL (project), path, &iter);
}
-
-
+
+ /* NOTE: Sensitive ordering here, we need to recurse after updating
+ * the tree model listeners (and update those listeners after our
+ * internal lists have been resolved), otherwise children are added
+ * before the parents (and the views dont like that).
+ */
+ if ((children = glade_widget_get_children (gwidget)) != NULL)
+ {
+ for (list = children; list && list->data; list = list->next)
+ glade_project_add_object
+ (project, old_project, G_OBJECT (list->data));
+ g_list_free (children);
+ }
/* Update user visible compatability info */
glade_project_verify_properties (gwidget);
+
+ g_signal_emit (G_OBJECT (project),
+ glade_project_signals [ADD_WIDGET],
+ 0, gwidget);
}
/**
@@ -4348,7 +4352,7 @@ glade_project_model_get_path (GtkTreeModel* model,
while ((parent = glade_widget_get_parent (widget)) != NULL)
{
- GList* children = glade_widget_get_children(parent);
+ GList* children = glade_widget_get_children (parent);
GList* child = g_list_find (children, glade_widget_get_object (widget));
g_assert (child != NULL);
@@ -4359,6 +4363,7 @@ glade_project_model_get_path (GtkTreeModel* model,
g_list_free (children);
widget = parent;
}
+
/* Get the index for the top-level list */
top = g_list_find (project->priv->tree,
glade_widget_get_object (toplevel));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]