Commit f46af86c authored by Corentin Noël's avatar Corentin Noël Committed by Corentin Noël

Couple of fixes for memory leaks found with valgrind

Most of them are unfreed string and missed GList elements.
parent 55f03589
Pipeline #83934 passed with stages
in 3 minutes and 40 seconds
......@@ -2921,12 +2921,13 @@ glade_eprop_object_populate_view_real (GtkTreeStore *model,
if (good_type || has_decendant)
{
gchar *prop_name = glade_eprop_object_name (widget_name, model, parent_iter);
gtk_tree_store_append (model, &iter, parent_iter);
gtk_tree_store_set
(model, &iter,
OBJ_COLUMN_WIDGET, widget,
OBJ_COLUMN_WIDGET_NAME,
glade_eprop_object_name (widget_name, model, parent_iter),
prop_name,
OBJ_COLUMN_WIDGET_CLASS, glade_widget_adaptor_get_title (adaptor),
/* Selectable if its a compatible type and
* its not itself.
......@@ -2935,6 +2936,7 @@ glade_eprop_object_populate_view_real (GtkTreeStore *model,
good_type && !search_list (exception_widgets, widget),
OBJ_COLUMN_SELECTED,
good_type && search_list (selected_widgets, widget), -1);
g_free (prop_name);
}
if (has_decendant &&
......
......@@ -1961,6 +1961,7 @@ glade_project_check_target_version (GladeProject *project)
GtkWidget *dialog;
GString *text;
GList *l;
gchar *project_name;
glade_project_get_target_version (project, "gtk+", &major, &minor);
......@@ -2010,12 +2011,14 @@ glade_project_check_target_version (GladeProject *project)
else
text = NULL;
project_name = glade_project_get_name (project);
dialog = gtk_message_dialog_new (GTK_WINDOW (glade_app_get_window ()),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
PROJECT_TARGET_DIALOG_TITLE_FMT,
glade_project_get_name (project),
project_name,
major, minor);
g_free (project_name);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("But this version of Glade is for GTK+ 3 only.\n"
......
......@@ -523,6 +523,8 @@ glade_signal_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
break;
}
}
g_list_free (signals);
return gtk_tree_path_new_from_indices (index0, index1, -1);
}
else if (widget)
......@@ -663,12 +665,10 @@ glade_signal_model_iter_next_signal (GladeSignalModel *sig_model,
glade_signal_model_create_signal_iter (sig_model, widget,
next_handler,
iter);
g_list_free (signal);
return TRUE;
}
else
{
g_list_free (signal);
return FALSE;
}
}
......@@ -703,7 +703,9 @@ glade_signal_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
glade_signal_class_get_name (sig_class));
if (glade_signal_model_is_dummy_handler (sig_model, handler))
{
return glade_signal_model_iter_next_signal (sig_model, widget, iter, signal);
gboolean ret = glade_signal_model_iter_next_signal (sig_model, widget, iter, signal);
g_list_free (signals);
return ret;
}
else if (handlers)
{
......@@ -730,7 +732,9 @@ glade_signal_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
}
else
{
return glade_signal_model_iter_next_signal (sig_model, widget, iter, signal);
gboolean ret = glade_signal_model_iter_next_signal (sig_model, widget, iter, signal);
g_list_free (signals);
return ret;
}
}
else
......
......@@ -1050,6 +1050,8 @@ glade_util_have_devhelp (void)
}
else
g_warning ("devhelp had bad return code: '%d'", ret);
g_free (ptr);
}
else
{
......
......@@ -2900,6 +2900,10 @@ glade_widget_adaptor_from_catalog (GladeCatalog *catalog,
*/
if (adaptor->priv->type != adaptor->priv->real_type)
{
if (adaptor->priv->signals)
g_list_free_full (adaptor->priv->signals,
(GDestroyNotify) glade_signal_class_free);
adaptor->priv->signals = gwa_list_signals (adaptor, adaptor->priv->real_type);
gwa_update_properties_from_type (adaptor, adaptor->priv->real_type,
......@@ -2912,6 +2916,7 @@ glade_widget_adaptor_from_catalog (GladeCatalog *catalog,
if (adaptor->priv->generic_name == NULL)
adaptor->priv->generic_name = g_strdup ("widget");
g_clear_pointer (&adaptor->priv->catalog, g_free);
adaptor->priv->catalog = g_strdup (glade_catalog_get_name (catalog));
if (glade_catalog_get_book (catalog))
......
......@@ -161,13 +161,12 @@ static gchar *
glade_xml_get_value (xmlNodePtr node, const gchar *name)
{
xmlNodePtr child;
gchar *ret = NULL;
for (child = node->children; child; child = child->next)
if (!xmlStrcmp (child->name, BAD_CAST (name)))
ret = claim_string (xmlNodeGetContent (child));
return claim_string (xmlNodeGetContent (child));
return ret;
return NULL;
}
/**
......
......@@ -534,7 +534,7 @@ eprop_model_data_generate_store (GladeEditorProperty *eprop)
GtkListStore *store = NULL;
GladeModelData *iter_data;
GNode *data_tree = NULL, *iter_node, *row_node;
GArray *gtypes = g_array_new (FALSE, TRUE, sizeof (GType));
GArray *gtypes = NULL;
GtkTreeIter iter;
gint column_num, row_num;
GType index_type = G_TYPE_INT, string_type = G_TYPE_STRING, pointer_type = G_TYPE_POINTER;
......@@ -546,6 +546,7 @@ eprop_model_data_generate_store (GladeEditorProperty *eprop)
return NULL;
/* Generate store with tailored column types */
gtypes = g_array_new (FALSE, TRUE, sizeof (GType));
g_array_append_val (gtypes, index_type);
for (iter_node = data_tree->children->children; iter_node;
iter_node = iter_node->next)
......
......@@ -140,26 +140,27 @@ refresh_title (GladeWindow *window)
if (GLADE_WINDOW_ACTIVE_VIEW (window))
{
GladeProject *project = glade_design_view_get_project (GLADE_WINDOW_ACTIVE_VIEW (window));
gchar *title, *name = NULL;
gchar *title;
GList *p;
gtk_header_bar_set_custom_title (window->priv->headerbar, NULL);
name = glade_project_get_name (project);
title = glade_project_get_name (project);
if (glade_project_get_modified (project))
name = g_strdup_printf ("*%s", name);
else
name = g_strdup (name);
{
gchar *old_title = g_steal_pointer (&title);
title = g_strdup_printf ("*%s", old_title);
g_free (old_title);
}
if (glade_project_get_readonly (project) != FALSE)
title = g_strdup_printf ("%s %s", name, READONLY_INDICATOR);
else
title = g_strdup_printf ("%s", name);
{
gchar *old_title = g_steal_pointer (&title);
title = g_strdup_printf ("%s %s", old_title, READONLY_INDICATOR);
}
gtk_header_bar_set_title (window->priv->headerbar, title);
g_free (title);
g_free (name);
if ((p = glade_app_get_projects ()) && g_list_next (p))
gtk_header_bar_set_custom_title (window->priv->headerbar, window->priv->project_switcher);
......
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