[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-no
From: |
Yuan Fu |
Subject: |
bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer |
Date: |
Sat, 23 Dec 2023 19:00:34 -0800 |
> On Dec 23, 2023, at 12:08 AM, Yuan Fu <casouri@gmail.com> wrote:
>
>
>
>> On Dec 22, 2023, at 11:26 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> From: Denis Zubarev <dvzubarev@yandex.ru>
>>> Date: Sat, 23 Dec 2023 02:18:20 +0300
>>>
>>> 1. emacs -Q
>>> 2. M-x find-file /tmp/t.py
>>> 3. paste there
>>> start=1
>>> def _init(self, param1, param2, param3=False):
>>> self._param1 = param2
>>> self._param2 = param2
>>> self._param3 = param3
>>> 4. python-ts-mode
>>> 5. select two last lines and M-x narrow-to-region
>>> 6. answer all prompts
>>> 7. Put cursor on the last self
>>> 8. M-x eval-expression
>>> (progn
>>> (setq temp-node (treesit-node-at (point)))
>>> (sit-for 2)
>>> (garbage-collect)
>>> (message "node %s" temp-node))
>>> 9. Emacs crashes or prints node that contains garbage
>>
>> Thanks.
>>
>> Yuan, this also happens on the emacs-29 branch, so we should try
>> fixing this crash ASAP.
>
> Yeah. The node wants to print it’s type name (with ts_node_type), which
> access it’s parse tree, but the tree is already freed, that means the node is
> outdated and shouldn’t try to print it’s type name, but should rather print
> “outdated”.
>
> But simply narrowing the buffer shouldn’t reparse the buffer and cause the
> parse tree to be freed. Anyway, let me see what’s going on.
I pushed a fix and now it shouldn’t crash anymore. However, I’m yet not sure
why at some point the buffer was widened. Is there any way to track who called
widen?
Yuan
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Denis Zubarev, 2023/12/22
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Eli Zaretskii, 2023/12/23
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Yuan Fu, 2023/12/23
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer,
Yuan Fu <=
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Eli Zaretskii, 2023/12/24
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Yuan Fu, 2023/12/26
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Eli Zaretskii, 2023/12/27
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Yuan Fu, 2023/12/28
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Dmitry Gutov, 2023/12/28
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Eli Zaretskii, 2023/12/28
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Dmitry Gutov, 2023/12/28
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Yuan Fu, 2023/12/29
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Dmitry Gutov, 2023/12/29
- bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer, Yuan Fu, 2023/12/29