Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: Frank Lanitz frank@frank.uvena.de Date: Thu, 25 Jun 2015 18:40:47 UTC Commit: 00ecbcca3ea9a67adda893b7b5367c86049daa3a https://github.com/geany/geany-plugins/commit/00ecbcca3ea9a67adda893b7b5367c...
Log Message: ----------- Merge pull request #252 from b4n/geanysendmail/dialog-crash
GeanySendMail: Fix crashes in the address dialog
Modified Paths: -------------- geanysendmail/src/geanysendmail.c
Modified: geanysendmail/src/geanysendmail.c 13 lines changed, 6 insertions(+), 7 deletions(-) =================================================================== @@ -72,8 +72,6 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g gchar *command = NULL; GError *error = NULL; GString *cmd_str = NULL; - GKeyFile *config = g_key_file_new(); - gchar *config_dir = g_path_get_dirname(config_file); gchar *data;
doc = document_get_current(); @@ -95,6 +93,8 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g cmd_str = g_string_new(mailer); if ((use_address_dialog == TRUE) && (g_strrstr(mailer, "%r") != NULL)) { + GKeyFile *config = NULL; + gchar *config_dir = NULL; gchar *input = dialogs_show_input(_("Recipient's Address"), GTK_WINDOW(geany->main_widgets->window), _("Enter the recipient's e-mail address:"), @@ -102,6 +102,7 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g
if (input) { + config = g_key_file_new(); g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
g_free(address); @@ -116,6 +117,7 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g return; }
+ config_dir = g_path_get_dirname(config_file); if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils_mkdir(config_dir, TRUE) != 0) { @@ -128,9 +130,9 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g data = g_key_file_to_data(config, NULL, NULL); utils_write_file(config_file, data); g_free(data); - g_key_file_free(config); - g_free(config_dir); } + g_key_file_free(config); + g_free(config_dir); }
if (! utils_string_replace_all(cmd_str, "%f", locale_filename)) @@ -142,7 +144,6 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g if (! utils_string_replace_all(cmd_str, "%r", address)) ui_set_statusbar(FALSE, _("Recipient address placeholder not found. The executed command might have failed.")); - g_free(address); } else { @@ -172,8 +173,6 @@ send_as_attachment(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer g { ui_set_statusbar(FALSE, _("File has to be saved before sending.")); } - - g_key_file_free(config); }
static void key_send_as_attachment(G_GNUC_UNUSED guint key_id)
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).