Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 07 May 2017 14:02:07 UTC Commit: 1c0ef17f4b0a04c7322b38dd23bd4d9a3ec406d2 https://github.com/geany/geany-plugins/commit/1c0ef17f4b0a04c7322b38dd23bd4d...
Log Message: ----------- Stop processing if the document gets invalid
This might happen if the current document is closed during a check of a large document.
Fixes #547.
Modified Paths: -------------- spellcheck/src/speller.c
Modified: spellcheck/src/speller.c 8 lines changed, 8 insertions(+), 0 deletions(-) =================================================================== @@ -211,6 +211,9 @@ gint sc_speller_process_line(GeanyDocument *doc, gint line_number) g_return_val_if_fail(sc_speller_dict != NULL, 0); g_return_val_if_fail(doc != NULL, 0);
+ if (! DOC_VALID(doc)) + return 0; /* current document has been closed */ + /* add ' (single quote) temporarily to wordchars * to be able to check for "doesn't", "isn't" and similar */ wordchars_len = scintilla_send_message(doc->editor->sci, SCI_GETWORDCHARS, 0, 0); @@ -317,6 +320,11 @@ void sc_speller_check_document(GeanyDocument *doc) { for (i = first_line; i < last_line; i++) { + if (! DOC_VALID(doc)) + { /* current document has been closed (might happen while checking large files) */ + ui_progress_bar_stop(); + return; + } suggestions_found += sc_speller_process_line(doc, i);
/* process other GTK events to keep the GUI being responsive */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org