[geany/geany] 5d3b2f: Fix crash if document closed while custom command is executing

elextr git-noreply at xxxxx
Mon Feb 10 01:19:45 UTC 2014


Branch:      refs/heads/master
Author:      elextr <elextr at gmail.com>
Committer:   elextr <elextr at gmail.com>
Date:        Mon, 10 Feb 2014 01:19:45 UTC
Commit:      5d3b2f6269dc9151d9d72ab550539e6de37a439f
             https://github.com/geany/geany/commit/5d3b2f6269dc9151d9d72ab550539e6de37a439f

Log Message:
-----------
Fix crash if document closed while custom command is executing

Custom command callback never checked that the doc was still valid.
Can still paste in the wrong doc if user closes and opens while
the command is running, but not crash.


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

Modified: src/tools.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -290,7 +290,7 @@ static gboolean cc_replace_sel_cb(gpointer user_data)
 		return TRUE;
 	}
 
-	if (! data->error && data->buffer != NULL)
+	if (! data->error && data->buffer != NULL && DOC_VALID(data->doc))
 	{	/* Command completed successfully */
 		sci_replace_sel(data->doc->editor->sci, data->buffer->str);
 	}



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list