Branch: refs/heads/master Author: Nick Treleaven ntrel002@gmail.com Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 12 Feb 2023 14:17:02 UTC Commit: e8a55b8e7f7ff36b0387a199f8b48e92466ed5d0 https://github.com/geany/geany/commit/e8a55b8e7f7ff36b0387a199f8b48e92466ed5...
Log Message: ----------- Fix #2599 - Save As dialog can save the wrong document
Modified Paths: -------------- src/dialogs.c
Modified: src/dialogs.c 14 lines changed, 7 insertions(+), 7 deletions(-) =================================================================== @@ -479,12 +479,11 @@ void dialogs_show_open_file(void) }
-static gboolean handle_save_as(const gchar *utf8_filename, gboolean rename_file) +static gboolean handle_save_as(GeanyDocument *doc, + const gchar *utf8_filename, gboolean rename_file) { - GeanyDocument *doc = document_get_current(); gboolean success = FALSE; - - g_return_val_if_fail(doc != NULL, FALSE); + g_return_val_if_fail(DOC_VALID(doc), FALSE); g_return_val_if_fail(!EMPTY(utf8_filename), FALSE);
if (doc->file_name != NULL) @@ -508,7 +507,8 @@ static gboolean handle_save_as(const gchar *utf8_filename, gboolean rename_file) }
-static gboolean save_as_dialog_handle_response(GtkWidget *dialog, gint response) +static gboolean save_as_dialog_handle_response(GeanyDocument *doc, + GtkWidget *dialog, gint response) { gboolean rename_file = FALSE; gboolean success = FALSE; @@ -535,7 +535,7 @@ static gboolean save_as_dialog_handle_response(GtkWidget *dialog, gint response) gchar *utf8_filename;
utf8_filename = utils_get_utf8_from_locale(new_filename); - success = handle_save_as(utf8_filename, rename_file); + success = handle_save_as(doc, utf8_filename, rename_file); g_free(utf8_filename); break; } @@ -640,7 +640,7 @@ static gboolean show_save_as_gtk(GeanyDocument *doc) { resp = gtk_dialog_run(GTK_DIALOG(dialog)); } - while (! save_as_dialog_handle_response(dialog, resp)); + while (! save_as_dialog_handle_response(doc, dialog, resp));
if (app->project && !EMPTY(app->project->base_path)) gtk_file_chooser_remove_shortcut_folder(GTK_FILE_CHOOSER(dialog),
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).