Kaydet (Commit) a3e5044d authored tarafından Colomban Wendling's avatar Colomban Wendling

Plug a few memory leaks

These leaks actually were not "real" leaks since the memory will anyway
be kept until quit.  Fixing those only makes the code "cleaner" and
will prevent them to "hide" some other (real) ones at debug times.
üst 90cf3072
......@@ -1883,6 +1883,12 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
}
static void free_on_closure_notify(gpointer data, GClosure *closure)
{
g_free(data);
}
/* @note You should connect to the "document-save" signal yourself to detect
* if the user has just saved the config file, reloading it. */
void ui_add_config_file_menu_item(const gchar *real_path, const gchar *label, GtkContainer *parent)
......@@ -1905,9 +1911,8 @@ void ui_add_config_file_menu_item(const gchar *real_path, const gchar *label, Gt
gtk_widget_show(item);
gtk_container_add(parent, item);
g_signal_connect(item, "activate", G_CALLBACK(on_config_file_clicked),
/* this memory is kept */
g_strdup(real_path));
g_signal_connect_data(item, "activate", G_CALLBACK(on_config_file_clicked),
g_strdup(real_path), free_on_closure_notify, 0);
}
......
......@@ -248,6 +248,7 @@ static void create_vte(void)
/* create menu now so copy/paste shortcuts work */
vc->menu = vte_create_popup_menu();
g_object_ref_sink(vc->menu);
frame = gtk_frame_new(NULL);
......@@ -291,6 +292,7 @@ void vte_close(void)
* this prevents a segfault on X close window if the message window is hidden */
gtk_widget_destroy(vc->vte);
gtk_widget_destroy(vc->menu);
g_object_unref(vc->menu);
g_free(vc->emulation);
g_free(vc->shell);
g_free(vc->font);
......
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