fix Segfault

This commit is contained in:
Mario Hüttel 2018-05-24 00:15:39 +02:00
parent da34256b83
commit 2c3c7a9a80

5
main.c
View File

@ -189,15 +189,16 @@ static void on_convert_clicked(gpointer button, gpointer user)
dialog = gtk_file_chooser_dialog_new("Save TeX File", GTK_WINDOW(data->main_window), GTK_FILE_CHOOSER_ACTION_SAVE, dialog = gtk_file_chooser_dialog_new("Save TeX File", GTK_WINDOW(data->main_window), GTK_FILE_CHOOSER_ACTION_SAVE,
"Cancel", GTK_RESPONSE_CANCEL, "Save", GTK_RESPONSE_ACCEPT, NULL); "Cancel", GTK_RESPONSE_CANCEL, "Save", GTK_RESPONSE_ACCEPT, NULL);
res = gtk_dialog_run(GTK_DIALOG(dialog)); res = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
if (res == GTK_RESPONSE_ACCEPT) { if (res == GTK_RESPONSE_ACCEPT) {
file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); file_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
tex_file = fopen(file_name, "w"); tex_file = fopen(file_name, "w");
g_free(file_name); g_free(file_name);
}
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
render_cell_to_code(cell_to_render, layer_list, tex_file); render_cell_to_code(cell_to_render, layer_list, tex_file);
fclose(tex_file); fclose(tex_file);
}
g_list_free_full(layer_list, (GDestroyNotify)delete_layer_info_struct); g_list_free_full(layer_list, (GDestroyNotify)delete_layer_info_struct);
} }