Commit 74a63bde authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

Fixed bug #679487 "Huge memory leaks"

parent d5e868b4
......@@ -2766,9 +2766,6 @@ glade_project_check_reordered (GladeProject *project,
GList *old_order)
{
GList *new_order, *l, *ll;
gint *order, n_children, i;
GtkTreeIter iter;
GtkTreePath *path;
g_return_if_fail (GLADE_IS_PROJECT (project));
g_return_if_fail (GLADE_IS_WIDGET (parent));
......@@ -2780,7 +2777,7 @@ glade_project_check_reordered (GladeProject *project,
/* Check if the list changed */
for (l = old_order, ll = new_order;
l && ll;
l = l->next, ll = ll->next)
l = g_list_next (l), ll = g_list_next (ll))
{
if (l->data != ll->data)
break;
......@@ -2788,23 +2785,20 @@ glade_project_check_reordered (GladeProject *project,
if (l || ll)
{
n_children = glade_project_count_children (project, parent);
order = g_new (gint, n_children);
gint *order = g_new0 (gint, g_list_length (new_order));
GtkTreePath *path;
GtkTreeIter iter;
gint i;
for (i = 0, l = new_order; l; l = l->next)
for (i = 0, l = new_order; l; l = g_list_next (l))
{
GObject *obj = l->data;
GList *node = g_list_find (old_order, obj);
if (glade_project_has_object (project, obj))
{
GList *node = g_list_find (old_order, obj);
g_assert (node);
order[i] = g_list_position (old_order, node);
g_assert (node);
i++;
}
order[i] = g_list_position (old_order, node);
i++;
}
/* Signal that the rows were reordered */
......
......@@ -3220,19 +3220,22 @@ glade_widget_child_set_property (GladeWidget *widget,
const gchar *property_name,
const GValue *value)
{
GList *old_order = NULL;
GladeWidgetPrivate *priv, *cpriv;
GList *old_order;
gboolean check;
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_WIDGET (child));
g_return_if_fail (property_name != NULL && value != NULL);
if (widget->priv->project &&
widget->priv->in_project)
old_order = glade_widget_get_children (widget);
priv = widget->priv;
cpriv = child->priv;
glade_widget_adaptor_child_set_property (widget->priv->adaptor,
widget->priv->object,
child->priv->object, property_name, value);
check = priv->project && priv->in_project && cpriv->project && cpriv->in_project;
old_order = (check) ? glade_widget_get_children (widget) : NULL;
glade_widget_adaptor_child_set_property (priv->adaptor, priv->object,
cpriv->object, property_name, value);
/* After setting a child property... it's possible the order of children
* in the parent has been effected.
......@@ -3241,9 +3244,8 @@ glade_widget_child_set_property (GladeWidget *widget,
* it's rows have been reordered so that any connected views update
* themselves properly.
*/
if (widget->priv->project &&
widget->priv->in_project)
glade_project_check_reordered (widget->priv->project, widget, old_order);
if (check)
glade_project_check_reordered (priv->project, widget, old_order);
g_list_free (old_order);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment