The `DOC_VALID` check needs to be moved up before the 2nd line of the function
where `doc->editor` is dereferenced, like this:
```c
static gboolean
automark(gpointer user_data)
{
GeanyDocument *doc = (GeanyDocument *)user_data;
/* during timeout document could be destroyed so check everything again
*/
if (!DOC_VALID(doc))
return FALSE;
GeanyEditor *editor = doc->editor;
static GeanyEditor *editor_cache = NULL;
ScintillaObject *sci = editor->sci;
gchar *text;
static gchar text_cache[GEANY_MAX_WORD_LENGTH] = {0};
gint match_flag = SCFIND_MATCHCASE | SCFIND_WHOLEWORD;
struct Sci_TextToFind ttf;
source_id = 0;
/* Do not highlight while selecting text and allow other markers to
work */
if (sci_has_selection(sci))
return FALSE;
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/574#issuecomment-492875232