From 5d3b2f6269dc9151d9d72ab550539e6de37a439f Mon Sep 17 00:00:00 2001 From: elextr Date: Mon, 10 Feb 2014 12:19:45 +1100 Subject: [PATCH] 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. --- src/tools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools.c b/src/tools.c index 607d5f47..3fb2517c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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); }