Christian Brabandt <[email protected]> wrote:
> Hi Dominique!
>
> On Do, 22 Nov 2012, Dominique Pellé wrote:
>
>> quickfix.c:
>>
>> 2861 if (wp != NULL)
>> 2862 qi = GET_LOC_LIST(wp);
>> 2863 #ifdef FEAT_AUTOCMD
>> 2864 if (au_name != NULL)
>> 2865 {
>> 2866 apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
>> 2867 curbuf->b_fname,
>> TRUE, curbuf);
>> 2868 if (qi->qf_curlist < qi->qf_listcount)
>> 2869 res = qi->qf_lists[qi->qf_curlist].qf_count;
>> 2870 else
>> 2871 res = 0;
>> 2872 }
>>
> […]
>> Vim: Caught deadly signal SEGV
>> Vim: Finished.
>> Segmentation fault (core dumped)
>>
>> I don't know yet why some pointers are NULL but perhaps someone
>> can make sense of it.
>
> I see. Try this patch:
> diff --git a/src/quickfix.c b/src/quickfix.c
> --- a/src/quickfix.c
> +++ b/src/quickfix.c
> @@ -2863,7 +2863,7 @@
> {
> apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
> curbuf->b_fname, TRUE, curbuf);
> - if (qi->qf_curlist < qi->qf_listcount)
> + if (qi != NULL && qi->qf_curlist < qi->qf_listcount)
> res = qi->qf_lists[qi->qf_curlist].qf_count;
> else
> res = 0;
>
>
> regards,
> Christian
Hi Christian
I can't tell whether that's the right fix, but I confirm that
your proposed change avoids the crash at least.
wp->w_llist was set to NULL at line quickfix.c:914 which
was introduced by chane 3918 according to hg annotate:
911 vimboss 644: if (qi->qf_listcount == LISTCOUNT)
912 vimboss 7: {
913 bram 3918: if (wp != NULL && wp->w_llist == qi)
914 bram 3918: wp->w_llist = NULL;
915 vimboss 644: qf_free(qi, 0);
===
changeset: 3918:4f0ddf4137ee
tag: v7-3-715
user: Bram Moolenaar <[email protected]>
date: Wed Nov 14 22:38:08 2012 +0100
files: src/quickfix.c src/testdir/test49.ok
src/testdir/test49.vim src/version.c
description:
updated for version 7.3.715
Problem: Crash when calling setloclist() in BufUnload autocmd. (Marcin
Szamotulski)
Solution: Set w_llist to NULL when it was freed. Also add a test.
(Christian Brabandt)
===
I find it odd that a function called qf_new_list() clears
wp->w_llist (set it to NULL) and does not set it back
to something else. The name of the function "qf_new_list()"
suggests that it should create another list, so perhaps
it should set wp->w_llist to something else. But I don't
understand the code here.
Regards
-- Dominique
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php