[geany/geany-plugins] ed831e: geniuspaste: Check result of dialogs_show_save_as() to prevent segfault

Matthew Brush git-noreply at xxxxx
Sat Jun 16 21:19:33 UTC 2012


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Sat, 16 Jun 2012 21:19:33
Commit:      ed831e5a8892b80267cf7784d59d277f3791808c
             https://github.com/geany/geany-plugins/commit/ed831e5a8892b80267cf7784d59d277f3791808c

Log Message:
-----------
geniuspaste: Check result of dialogs_show_save_as() to prevent segfault

Fixes crash when an unsaved file is open and the Paste It! item is clicked,
when it shows the Save As dialog and you cancel it, the paste() function
gets run anyway, working on a NULL file_name (ie. last_indexof/strrchr).


Modified Paths:
--------------
    geniuspaste/src/geniuspaste.c

Modified: geniuspaste/src/geniuspaste.c
7 files changed, 6 insertions(+), 1 deletions(-)
===================================================================
@@ -396,7 +396,12 @@ static void item_activate(GtkMenuItem * menuitem, gpointer gdata)
     }
     else if(doc->file_name == NULL)
     {
-        dialogs_show_save_as();
+        if (dialogs_show_save_as() == FALSE)
+        {
+            dialogs_show_msgbox(GTK_MESSAGE_ERROR,
+                _("A filename is needed and saving the current document was cancelled.\n"));
+            return;
+        }
     }
     else if(doc->changed)
     {


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Plugins-Commits mailing list