From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#72238: 31.0.50; Segfault after treesit_delete_query Date: Tue, 23 Jul 2024 09:44:56 -0700 Message-ID: References: <87h6cixu2i.fsf@pub.pink> <865xsxbrrf.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12432"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Noah Peart , john muhl , 72238@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 23 18:47:29 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sWIff-0002wq-EY for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Jul 2024 18:47:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWIfF-00042I-If; Tue, 23 Jul 2024 12:47:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sWIfC-000420-BJ for bug-gnu-emacs@gnu.org; Tue, 23 Jul 2024 12:46:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWIfC-0002l5-2h for bug-gnu-emacs@gnu.org; Tue, 23 Jul 2024 12:46:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sWIfG-0003xG-Jy for bug-gnu-emacs@gnu.org; Tue, 23 Jul 2024 12:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Jul 2024 16:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72238 X-GNU-PR-Package: emacs Original-Received: via spool by 72238-submit@debbugs.gnu.org id=B72238.172175318715157 (code B ref 72238); Tue, 23 Jul 2024 16:47:02 +0000 Original-Received: (at 72238) by debbugs.gnu.org; 23 Jul 2024 16:46:27 +0000 Original-Received: from localhost ([127.0.0.1]:60629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWIeg-0003wP-Je for submit@debbugs.gnu.org; Tue, 23 Jul 2024 12:46:26 -0400 Original-Received: from mail-pl1-f182.google.com ([209.85.214.182]:51644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWIee-0003wB-8a for 72238@debbugs.gnu.org; Tue, 23 Jul 2024 12:46:24 -0400 Original-Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1fd640a6454so7226905ad.3 for <72238@debbugs.gnu.org>; Tue, 23 Jul 2024 09:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721753114; x=1722357914; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+qc7qiYos2tW2DBJCovywKOAp4pYbS6nihTnBfqBmkQ=; b=Zh8VxVvCYeBi4xkUE+ScAAnPTeRH4a8wKkmlbDB5mE8NCBldTtEbzB67q/NPJDXkAg 9gY4xEN0goCgACYlTdo8vdlef2fScaomFrEL3EpsmsnIkhgrmSjTy6lSESaKmlUQtNCc rSN+lcPBoTJ2J0y2uoZ446W37nj5fw1HvEAqi1DyRYNMb9APiEkHpnh0UZ/abCBAvV3E F0cJFH46xAohS8jCQk2XN8ThJzN7EnW8c1xHC6YSbquh1RqgysMVGLoV5qYHbBmfEs2I D51KEKMcQ5Xfr7kkve2u0N78OAYTOOQYjGdTE2jTSK0lBKE7fvSwUnciEYT3j/XY83yv 9unw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721753114; x=1722357914; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+qc7qiYos2tW2DBJCovywKOAp4pYbS6nihTnBfqBmkQ=; b=PUH/pRWmEYZQbI2wzQXZ8ZZo5oLrMu8utrlzB+5T50OU8ofVeHYFLhaBBwQiks6YsA ZwAxmhz1GAzoZ4hAF3hNS20atSMwkipSpL+OjUxmb8Boju4E0GvEWsHHSeSsNxDnYPm1 kXoY+m9XAJ/wfJZKEuTHauYhguLtTY2fr1AL9fg3+P+yvq9sVH7YmEg4DaijN2cSmaek yVlPywscuR9LR9X9gYF9EQXBHYAynHL1TW9hT4lC0Osh51fJwAmer3Sdl7vn1OUKCl1t GXUYV3eqFVxRZaLllyul/NvGk49XrB5+Qx+BdRjkzk4ioBXBq4bGwFidH6N86NoXrSop CWeQ== X-Forwarded-Encrypted: i=1; AJvYcCXgLcbtdVnFKyMgc+VYGOi4hy9a8XiFtiVbcD0x0/7UCS2BGLYWL5Xlli7XPccQ4FkATKwBSq1B4wUg8A+S7Hb8DElCBSM= X-Gm-Message-State: AOJu0YyDzZoQxmXDFdoVdpC/pbVZcvOz/E3VfgwHYKtBc/pxZf+8KooT kWshPW/TSjXqwc/E9X7YZTxZS9q0jmCves+D7N4dx63wMvViFs9QRQwDGA== X-Google-Smtp-Source: AGHT+IHEtVZt4heMTgYS98oztOtvNhzcGxEG/PVJFw1laVukiwH6WcEbn3u+f5jUZo95mh/ZFjWmYA== X-Received: by 2002:a17:903:186:b0:1fd:7fac:a539 with SMTP id d9443c01a7336-1fdd2115026mr3697125ad.16.1721753113696; Tue, 23 Jul 2024 09:45:13 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:c931:36dd:b6ff:8bfc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd6f45498bsm76884165ad.229.2024.07.23.09.45.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jul 2024 09:45:08 -0700 (PDT) In-Reply-To: <865xsxbrrf.fsf@gnu.org> X-Mailer: Apple Mail (2.3774.600.62) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289179 Archived-At: > On Jul 22, 2024, at 4:17=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> Cc: Noah Peart , 72238@debbugs.gnu.org >> From: Yuan Fu >> Date: Sun, 21 Jul 2024 17:01:31 -0700 >>=20 >>=20 >>=20 >>> On Jul 21, 2024, at 3:24=E2=80=AFPM, john muhl wrote: >>>=20 >>> Noah Peart writes: >>>=20 >>>> After recent build, emacs is crashing frequently when using = tree-sitter >>>> modes. >>>>=20 >>>> The following backtrace was generated after opening a few C files, >>>> enabling c-ts-mode, and moving the cursor around a bit. I dont have >>>> precise steps for repeatability at this point (sorry!), as it seems = to >>>> occur during garbage collection. >>>>=20 >>>> Let me know if there is more useful output I could provide. >>>=20 >>> Could you try reverting 1abf3bdd7ed and see if that helps? >>=20 >> Hey guys, sorry for the segfault. It=E2=80=99s indeed caused by = 1abf3bdd7ed, I just fixed it on master.=20 >=20 > Thanks, but I'm confused, since I see a fix both on emacs-30 and on > master. What exactly did you fix and on which branch(es)? Did the > problem exist on emacs-30 (it was reported for master)? Yeah, there=E2=80=99re two bugs: 1) we shouldn=E2=80=99t delete the = query object without checking for NULL, and 2) we shouldn=E2=80=99t = delete the cursor object without checking for NULL. In emacs-30, only = query could be NULL, cursor is always initialized; in emacs-master, due = to my recent change, both query and cursor could be NULL. So I added checks for both query and cursor in one commit and pushed to = master, and cherry-picked the commit to emacs-30.=20 Yuan=