From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Jan 2025 20:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 75636@debbugs.gnu.org, luangruo@yahoo.com X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, Po Lu Received: via spool by submit@debbugs.gnu.org id=B.173714492717478 (code B ref -1); Fri, 17 Jan 2025 20:16:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jan 2025 20:15:27 +0000 Received: from localhost ([127.0.0.1]:38926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tYskZ-0004Xp-1i for submit@debbugs.gnu.org; Fri, 17 Jan 2025 15:15:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tYskX-0004XF-4y for submit@debbugs.gnu.org; Fri, 17 Jan 2025 15:15:25 -0500 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 1tYskO-0006dz-OV for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2025 15:15:16 -0500 Received: from mail-10629.protonmail.ch ([79.135.106.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tYskJ-0006nJ-NY for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2025 15:15:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1737144909; x=1737404109; bh=AHmX5Uv8++wycBvmI08q5yQ0ctE6pAgXYMJ5f1jo0K4=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=b5Dq9TGmTtZXYtl3msGQlSKVgNozH5vdVI3WQoo1tFxW3SRY7X19ZHySGcbLy38tS AZyv+eEuQ4UtkxNKZZfbUCf0LMIw5lvdvnoYJbsxwd/fqw09vfEr+ip+AFT5osJIuk By1eYGU7PQaCPmtU+sUwrW5zL0m9mgIFuO8hCCZaGVDo8gwMLbY9lvuwT1ZAKgPVrH ufoByNshNyreGPn1wVfcs6WRCgqp86i42kkGsDclmtq1P/mUo+0okYnKdazrUiHz/Z pmd2Kn9SmFb6QvE/d9CzHvQr1CqnXNgG/UIyoWyLICiAVFN+LcgnXmNn9Qk0kNLii4 3d4uPqGErvXCg== Date: Fri, 17 Jan 2025 20:15:02 +0000 From: Pip Cet Message-ID: <87sephfb9k.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: f97a4e3f8014fb81db43b64cfe6a85b1f86b671c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=79.135.106.29; envelope-from=pipcet@protonmail.com; helo=mail-10629.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently leaks some memory, particularly when using tool bars. 1. The input "multicontext" created by: imc =3D gtk_im_multicontext_new (); g_object_ref (imc); is only unref'd once when destroying the frame. This leaves the refcount at 1 and leaks the object. 2. free_frame_tool_bar is never called in my experiments, so the toolbar widget isn't destroyed. This isn't usually a problem because it's just a small memory leak, but on the feature/igc branch, user data passed to glib must be protected in a special GC root structure; such structures accumulate when running in GTK, eventually reducing GC performance significantly. Unfortunately, valgrind doesn't seem to catch these memory leaks. From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 09:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.17371914202188 (code B ref 75636); Sat, 18 Jan 2025 09:11:02 +0000 Received: (at 75636) by debbugs.gnu.org; 18 Jan 2025 09:10:20 +0000 Received: from localhost ([127.0.0.1]:40116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ4qR-0000ZC-Gt for submit@debbugs.gnu.org; Sat, 18 Jan 2025 04:10:19 -0500 Received: from sonic305-20.consmr.mail.ne1.yahoo.com ([66.163.185.146]:45588) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tZ4qM-0000Ww-Tx for 75636@debbugs.gnu.org; Sat, 18 Jan 2025 04:10:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737191408; bh=iGurs71lENUZaOR3uYEVuAcd+2jQflTV+wXjJst63SI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=sjtPv4tCTZAF9rBQsmgILS9hiqivKTRuw64nqVecO4UGKjTveY7iRUZZxNWY8ulBG/8VxHrx3BMJEi2l7jfoImDyIMm+SIYTx2kjSOm5+rnw5ycwWT4Ue07gpbl0hixOfohN1aVFhoWyczrNPah8WCdHc0WTcEdePMBF6F7LhVYqyH+cGQiZIaBLJaMzHJJBhjBJbdpTwkEyFkSOazVwkTNNBC4xydjqROaxFRAmURsZMIuUZiYRAcn1C6B6l6EhKT/dnK1Uf0/DSYQkI11dlfbAMRy0xdd/3HVJzsZTxoXKwdIhVWI3KBh5n8YwBaPAwVr4D8HZz6W+7sZRcUoX/Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737191408; bh=LeEKJUpXe3ewdW7R/rpQrMFlZVH3L03NxqLxW0noq0k=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Gj/j2/wXHwm3UkD/m/caIZ3xBzCEWNsstPDDxACPWzC433j3GrnRtGqXlChaTfeyWTvpqHwKUl2M2rFXNwCOQVpP1YHfcxsiHxHWx/pxMtyPwcyT74U7bjf1nyl7RNLa+ffe6tz3JIqJRx6UVAGeSpCyZYV3siDWafWLaXAmLo4MBjpbN2IDhDtzxydlN6XEgNsUWffhMZ+Ob3EhN94ddTlap1+0Qn5P3lZO9T38V8TaRpkjwRUNqOzJFuDSllvSAIop5nsKwI9zo35ehh6SPp43wtXA0HlDwSadqa0S4xnz7jrtlrPOihBOAXihTpoKI3gC9PSnxiyuXsqSb8xw5Q== X-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xgo3Jo6k2AU5qQ2A6.pQ7QXwRAz8VWVG4aO6h8lnoESFljLS 51.AGnN3d56x.n1vCUlySX2BtMp0XrAJcrmPpQx4syjdapAp2AzkLWQrcFWBcnQCvtAVN6Y5XSOs 6OWknTdGaPJYEhp8B0dAYE8xzXVSfyqdP67AUbqmaYJ7nKRHZ1vFYBEY4pv3i X-Sonic-MF: X-Sonic-ID: 2b3bcd07-7ef8-424d-8a4d-614e3e9d945c Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sat, 18 Jan 2025 09:10:08 +0000 Received: by hermes--production-sg3-5b7954b588-f8smd (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8de89c151320dfa65f4225e1cb7588ed; Sat, 18 Jan 2025 09:10:06 +0000 (UTC) From: Po Lu In-Reply-To: <87sephfb9k.fsf@protonmail.com> (Pip Cet's message of "Fri, 17 Jan 2025 20:15:02 +0000") References: <87sephfb9k.fsf@protonmail.com> Date: Sat, 18 Jan 2025 17:10:00 +0800 Message-ID: <87r0501o9j.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23187 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 826 X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Pip Cet writes: > Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently > leaks some memory, particularly when using tool bars. > > 1. The input "multicontext" created by: > > imc = gtk_im_multicontext_new (); > g_object_ref (imc); > > is only unref'd once when destroying the frame. This leaves the > refcount at 1 and leaks the object. Strange, I was under the impression that IM contexts descended from GInitiallyUnowned. Evidently they don't, and as such, removing the g_object_ref will suffice. > 2. free_frame_tool_bar is never called in my experiments, so the toolbar > widget isn't destroyed. It is only supposed to be called when a frame's tool bar is disabled. while it is x_free_frame_resources that should release all resources when a frame is to be destroyed. From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jan 2025 11:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.17372010142647 (code B ref 75636); Sat, 18 Jan 2025 11:51:02 +0000 Received: (at 75636) by debbugs.gnu.org; 18 Jan 2025 11:50:14 +0000 Received: from localhost ([127.0.0.1]:40560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ7LB-0000gZ-IE for submit@debbugs.gnu.org; Sat, 18 Jan 2025 06:50:13 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:44749) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZ7L8-0000eB-Sn for 75636@debbugs.gnu.org; Sat, 18 Jan 2025 06:50:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1737201004; x=1737460204; bh=wNL5OynbtXppv1gBSUYGkH8d4V98d1HQVSXgD+UnyTg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=w7v8kbGMPqrdcaG0EzobCizNvbbLO4D2bdXGVqA//2pXz4zLFxe+OhZVeThv69Ojo CV6jEGoe5vjo6/vKMFUQL/om9SXcSLK5IXAJ3E0gFyqXekBhoKkcYTJVsd8U8G7Wwk Cet4krOmS2E1/Hk1ANLSCygBYBkoxwOALoS2ctFv2QUgEKjSVsdoByxo1ejCEEygI0 RknSPpzaAVjWw13sm+IxavihtKrS8K35GeOaj+RQHKrxht+QUmeHTPEeK1mYdTR7nU vhZwUKLElrjpWeWOfcLodrVd62Um7EXJsDWirO7Jmb+Uz3IrpI0nW61wayimkaom4d /Nph69IqVyfUQ== Date: Sat, 18 Jan 2025 11:49:58 +0000 From: Pip Cet Message-ID: <87sepgcpey.fsf@protonmail.com> In-Reply-To: <87r0501o9j.fsf@yahoo.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: d947af0ee92a234b3a35c299030a51804a5f8771 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) "Po Lu" writes: > Pip Cet writes: > >> Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently >> leaks some memory, particularly when using tool bars. >> >> 1. The input "multicontext" created by: >> >> imc =3D gtk_im_multicontext_new (); >> g_object_ref (imc); >> >> is only unref'd once when destroying the frame. This leaves the >> refcount at 1 and leaks the object. > > Strange, I was under the impression that IM contexts descended from > GInitiallyUnowned. Evidently they don't, and as such, removing the > g_object_ref will suffice. Thanks! I'll just do that, then? I think it's okay only to do it on master, as it's a minor bug in the !HAVE_MPS case. >> 2. free_frame_tool_bar is never called in my experiments, so the toolbar >> widget isn't destroyed. > > It is only supposed to be called when a frame's tool bar is disabled. > while it is x_free_frame_resources that should release all resources > when a frame is to be destroyed. Thanks! I'll come up with a patch and discuss it further for this one, because it's not quite trivial. Pip From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Jan 2025 00:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.173724803510619 (code B ref 75636); Sun, 19 Jan 2025 00:54:01 +0000 Received: (at 75636) by debbugs.gnu.org; 19 Jan 2025 00:53:55 +0000 Received: from localhost ([127.0.0.1]:44256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZJZa-0002lD-I9 for submit@debbugs.gnu.org; Sat, 18 Jan 2025 19:53:54 -0500 Received: from sonic302-22.consmr.mail.ne1.yahoo.com ([66.163.186.148]:40153) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tZJZX-0002ky-Eu for 75636@debbugs.gnu.org; Sat, 18 Jan 2025 19:53:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737248024; bh=sLUiNXCzKoV+EFUSdLdzwWjfXCLs7VTIIX8UzLhLF0g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=RNIICSLplegNkkC+MJtoJVCq1uTPrk74YBEZG9vegA+7f/3Tabz/8f02Qa4X0wHjk4nwuldaSsSX7DIs2BcMgdULiHIpvUvxZnQayrX1r3aWJextvSeQdgieZe1kvhlYPQyUnMj7ItFxr3nRmKoEcC43vNMIPitA8VPaoESOV5RuU/EFu7jwbKTlpOfCthyl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P44ZuKx2Q4bFwwMybqJkuc CLa6ZTfjhEfxAGTptjCkxW28ww9lLtOZ44LzKZDZ_qIHWMENOYj.b3PeqPYxFqgyQp2uPLb1vLTN gzCpAN_IkrzWh6ckCWajveoh1lScwRArOzOdGEY42mPdrlPT5S6dl.lGxdLElP2aF25vgNyHetl3 CQxW5fsHbT9QHeiiwGcWgnt7Q_QtVoQmBpI2nMsRmOPXWlCBSvReYiczAl.GOFi2doQvQNZSjWz2 hJMfPP6Wzz0ndoG3rrXliclT_vTUFXf2k4.Kw.Pn3j28v9sbtNxrv_wkLyMGPtWakwytrHdhsxG2 NJWSgBLhu53xqI8mdSuJ0bA97vUFRfo8xvJnlaMDnEhb5D1H3M4OilAgVrgcDXGiZa0KIVhoYUbw swd3Zff_PmUnRktO3.jIMKTy4sQ2ph6kCb.mLF0j9UZMNdx0WQ0uOsPBeaKoaDh3RQ3axrlBrIbf FPqXC73JRmZcV1Gj_ByNPQ3xGL513quJ8mXlS3F4MV9HNXINfQg2xSZLFxE8QUgbZWrSFe_uKGa6 TekkFnOkFMUFV.Lj6pQ5wtOq7eA3RU6HXKHruDOzRXJ2CKWiHwgkro3I7lnN.hV9Obfsmq2qLehs jNzinLV1v3lf4UF.m3Jte6My6nVT_2bM0wFDzAoe.x73d4M0Va49uLXj3SVLzJAix6Va8nQR_zEl LjFl3ArzJ26jmnwPT3wrIrkYp.5EpG8oDDOrT6vU5I4BQoGyL0tbGGuA_Bgpc4grOlLi904H5s_n FUrqciuLfh6fqORaVxt9joL4WgCwMJKwagJDRORMSWKehfJh8khWw5c.vROzW4zk- X-Sonic-MF: X-Sonic-ID: 6669af38-01c5-40b8-9c42-3b5e36c0a9bf Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Sun, 19 Jan 2025 00:53:44 +0000 Received: by hermes--production-sg3-5b7954b588-wvg78 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9b734e848d7082b295d55e5b19b4ea90; Sun, 19 Jan 2025 00:53:40 +0000 (UTC) From: Po Lu In-Reply-To: <87sepgcpey.fsf@protonmail.com> (Pip Cet's message of "Sat, 18 Jan 2025 11:49:58 +0000") References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> Date: Sun, 19 Jan 2025 08:53:34 +0800 Message-ID: <871pwz1v5d.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23187 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1233 X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Pip Cet writes: > "Po Lu" writes: > >> Pip Cet writes: >> >>> Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently >>> leaks some memory, particularly when using tool bars. >>> >>> 1. The input "multicontext" created by: >>> >>> imc = gtk_im_multicontext_new (); >>> g_object_ref (imc); >>> >>> is only unref'd once when destroying the frame. This leaves the >>> refcount at 1 and leaks the object. >> >> Strange, I was under the impression that IM contexts descended from >> GInitiallyUnowned. Evidently they don't, and as such, removing the >> g_object_ref will suffice. > > Thanks! I'll just do that, then? I think it's okay only to do it on > master, as it's a minor bug in the !HAVE_MPS case. Sounds good to me. >>> 2. free_frame_tool_bar is never called in my experiments, so the toolbar >>> widget isn't destroyed. >> >> It is only supposed to be called when a frame's tool bar is disabled. >> while it is x_free_frame_resources that should release all resources >> when a frame is to be destroyed. > > Thanks! I'll come up with a patch and discuss it further for this one, > because it's not quite trivial. > > Pip Thanks. From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jan 2025 11:25:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.173745867718868 (code B ref 75636); Tue, 21 Jan 2025 11:25:07 +0000 Received: (at 75636) by debbugs.gnu.org; 21 Jan 2025 11:24:37 +0000 Received: from localhost ([127.0.0.1]:53456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taCN2-0004uF-L7 for submit@debbugs.gnu.org; Tue, 21 Jan 2025 06:24:37 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]:49415) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taCMy-0004ts-ES for 75636@debbugs.gnu.org; Tue, 21 Jan 2025 06:24:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1737458665; x=1737717865; bh=Qbty11XRcaP6XyWAuHcvGW+cEtoZK/QDbjH+H0TtUyU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=O+CIqsviOtFqeTj9zKKR9gbWu2kI78jIjDUL3Wl/XJ8mZL11sL8OARJrBhVAgy2ar 3wCSRtcp1JGmw9q1YFo9jdZcy5AbvJfbjVKw++VmmLQ4mu4E4q82hduU+QAJRSRy8V jsFtLRQUlC6szmdMXaHZ8UgFwTsD3hb0iilBjRwebJ55kQ/BxTB8NYytxv4Z/90FFQ ivIXGROjguzsZzoGcZOwizzEylzm7Bt1QnOIvbAYP8FmdfWS9wAfAm7KuVG28y8ddp reZob/4nTgcRvK51+eyEb9cctF0b319wJgSh53DUA6sGWQyYDAkgRvHd7ChkcIoxrP QJR3WTwtr/wlQ== Date: Tue, 21 Jan 2025 11:24:21 +0000 From: Pip Cet Message-ID: <877c6ol89s.fsf@protonmail.com> In-Reply-To: <871pwz1v5d.fsf@yahoo.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: a6a46eb1644d7d52abf84fde2c41d1faa21bcc64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Po Lu" writes: > Pip Cet writes: > >> "Po Lu" writes: >> >>> Pip Cet writes: >>> >>>> Creating and destroying GTK frames (using gtkutil.c, not PGTK) current= ly >>>> leaks some memory, particularly when using tool bars. >>>> >>>> 1. The input "multicontext" created by: >>>> >>>> imc =3D gtk_im_multicontext_new (); >>>> g_object_ref (imc); >>>> >>>> is only unref'd once when destroying the frame. This leaves the >>>> refcount at 1 and leaks the object. >>> >>> Strange, I was under the impression that IM contexts descended from >>> GInitiallyUnowned. Evidently they don't, and as such, removing the >>> g_object_ref will suffice. >> >> Thanks! I'll just do that, then? I think it's okay only to do it on >> master, as it's a minor bug in the !HAVE_MPS case. > > Sounds good to me. > >>>> 2. free_frame_tool_bar is never called in my experiments, so the toolb= ar >>>> widget isn't destroyed. >>> >>> It is only supposed to be called when a frame's tool bar is disabled. >>> while it is x_free_frame_resources that should release all resources >>> when a frame is to be destroyed. >> >> Thanks! I'll come up with a patch and discuss it further for this one, >> because it's not quite trivial. >> >> Pip > > Thanks. This showed up during testing, but might ultimately have been because I deleted the new frame too soon. I can only reproduce it on the feature/igc branch, but that might be because the timing is different on that branch. When we create the initial tool bar, f->tool_bar_items is still Qnil. In that case, we don't pack the toolbar widget, but create it and connect signals to it. xg_free_frame_widgets does not explicitly delete the toolbar, which works only if it's packed and destroyed implicitly. I think this is right, and the bug isn't reproducible on the master branch only because of timing differences: commit 5ed4aaa986dbf75f8565f4d8cdd3d1d1b38b6142 (HEAD) Author: Pip Cet Destroy GTK tool bar widget if it was never attached (bug#75636) =20 * src/gtkutil.c (xg_free_frame_widgets): Call gtk_widget_destroy on an unpacked toolbar widget. diff --git a/src/gtkutil.c b/src/gtkutil.c index 0e9dd4dfe11..97582a524da 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1885,6 +1885,12 @@ xg_free_frame_widgets (struct frame *f) if (tbinfo) xfree (tbinfo); =20 + if (x->toolbar_widget && !x->toolbar_is_packed) +=09{ +=09 gtk_widget_destroy (x->toolbar_widget); +=09 x->toolbar_widget =3D NULL; +=09} + /* x_free_frame_resources should have taken care of it */ #ifndef HAVE_PGTK #ifdef HAVE_XDBE I think this second patch might also avoid future compiler warnings: diff --git a/src/gtkutil.c b/src/gtkutil.c index 97582a524da..73e9f778c75 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -6123,8 +6123,7 @@ free_frame_tool_bar (struct frame *f) else gtk_widget_destroy (x->toolbar_widget); =20 - x->toolbar_widget =3D 0; - x->toolbar_widget =3D 0; + x->toolbar_widget =3D NULL; x->toolbar_is_packed =3D false; FRAME_TOOLBAR_TOP_HEIGHT (f) =3D FRAME_TOOLBAR_BOTTOM_HEIGHT (f) =3D= 0; FRAME_TOOLBAR_LEFT_WIDTH (f) =3D FRAME_TOOLBAR_RIGHT_WIDTH (f) =3D 0= ; If we can apply the first, minor patch, I think this bug can be closed; if I run into further GTK issues, I'll open a new one. Pip From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jan 2025 18:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet , Po Lu Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.173748447919997 (code B ref 75636); Tue, 21 Jan 2025 18:35:01 +0000 Received: (at 75636) by debbugs.gnu.org; 21 Jan 2025 18:34:39 +0000 Received: from localhost ([127.0.0.1]:56076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taJ5D-0005CS-B3 for submit@debbugs.gnu.org; Tue, 21 Jan 2025 13:34:39 -0500 Received: from [2a00:1450:4864:20::533] (port=42130 helo=mail-ed1-x533.google.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taJ4g-0005Au-9T for 75636@debbugs.gnu.org; Tue, 21 Jan 2025 13:34:06 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5d41848901bso169239a12.0 for <75636@debbugs.gnu.org>; Tue, 21 Jan 2025 10:34:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737484432; x=1738089232; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=/pyZc0JbHxcSTDAbQtCT7La1CAbEVI1D4OkDaoTB80o=; b=kx5YNvpSjQM2ahd8A8L/PTYWb5wCjqyAAZvkLr5ssCjOCGL4SfOgdW72m2H8NI4FV3 oYWc/v3F+UtpIam+HgEp2uEOK1hWbFz5NXXebFjQNXcyl0jGDvI1NAPvnJYvn2iD7OEj NHC+K6gbTtijJdtfAuBZjMqernnkgl7XJkJEa7iXyOTeAAyM6QnJbtsaHDop9cCxzcG9 B21ao45f7/WGvIpa1KWM7UrP/7cenwfACku3TTgf5tj17bJmjTxx0uKQaH27COhMq+tg J3bcZQ+2i14mFisSrgaOBNG223vQh2bFt6HRzpoo6ihZpN9a8mOCdbRXuISGlbc/5MR9 iJrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737484432; x=1738089232; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/pyZc0JbHxcSTDAbQtCT7La1CAbEVI1D4OkDaoTB80o=; b=i0rAy1gResx8JnVHwhTRqLUkK2sOqtSZOE/PERgNsMrTh4/pYpKmHF/S1lxOOi2Hhe cHzMKRoM7EmfEw3uuWo2ExGTPWN5v9d4z0gynz9o7bhYoKcQkMLZOAdkRU4FhjWmbij6 MoE98FPXUrVYbL9A+uRMXQL0bCKgqMuYezzRtLrY0fzGqFCJ3UaTglDsn4fG/mKBcdnT snuU/YNMriq/yLvwQYCztmwQGNSqO36z4OIER6SDPdzPyTUeN7DAVYIxQJ5fm/3Xi1A8 H2luJcvhlJd7Xi5FoIx3OzsbluySWPWLsVXc/0IrdlUfZLaPZBi0/FrOTGDYIMnmUM44 ONHQ== X-Gm-Message-State: AOJu0YyonGoSdc23jCLb8KzXgm3LYEw8xw71yyibVCM33rmz+D5wAaJ6 AzaSN53+4jKHcHcMDr+oUoxG4TvGJw+YDeTv9iJrIC/HyZXB4pdi5FeGMY8ulfcXAerQGgXBRlq r/7GIiypj6bP7M5vRxBZyKDjTAnA= X-Gm-Gg: ASbGncveoFJArfPvV+Qr03jtqYCSWWzhwrjyG2lDX7FK6JEBl/erBLxysCHFsxnV1OB dXpIq7peobiV+I4oWzzc4ic/RoihpF3+hvGZimZRJG8mIsDNLfdw9 X-Google-Smtp-Source: AGHT+IEQ3tJ905X7htLFhzdkTp7CdJpDvKTU6dFSk1jT8mPxUEOE/jYIbwdlTIFA/wyE7Z0Z0CU+8r5rT0HAE1qZY24= X-Received: by 2002:a05:6402:510b:b0:5d9:6633:8eb1 with SMTP id 4fb4d7f45d1cf-5da0c35d5a2mr23169541a12.14.1737484431576; Tue, 21 Jan 2025 10:33:51 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 10:33:51 -0800 From: Stefan Kangas In-Reply-To: <877c6ol89s.fsf@protonmail.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> <877c6ol89s.fsf@protonmail.com> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 10:33:51 -0800 X-Gm-Features: AbW1kvbfluhioaoowNJZ5MLYusMRpjrGD93lOOx92xAfjiQiDEs9tO_z-N9B2uA Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > I think this second patch might also avoid future compiler warnings: > > diff --git a/src/gtkutil.c b/src/gtkutil.c > index 97582a524da..73e9f778c75 100644 > --- a/src/gtkutil.c > +++ b/src/gtkutil. [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:533 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > I think this second patch might also avoid future compiler warnings: > > diff --git a/src/gtkutil.c b/src/gtkutil.c > index 97582a524da..73e9f778c75 100644 > --- a/src/gtkutil.c > +++ b/src/gtkutil.c > @@ -6123,8 +6123,7 @@ free_frame_tool_bar (struct frame *f) > else > gtk_widget_destroy (x->toolbar_widget); > > - x->toolbar_widget = 0; > - x->toolbar_widget = 0; > + x->toolbar_widget = NULL; > x->toolbar_is_packed = false; > FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; > FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; LGTM. From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jan 2025 00:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pip Cet Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.17375065638332 (code B ref 75636); Wed, 22 Jan 2025 00:43:02 +0000 Received: (at 75636) by debbugs.gnu.org; 22 Jan 2025 00:42:43 +0000 Received: from localhost ([127.0.0.1]:58334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taOpL-0002AC-Sj for submit@debbugs.gnu.org; Tue, 21 Jan 2025 19:42:43 -0500 Received: from sonic305-22.consmr.mail.ne1.yahoo.com ([66.163.185.148]:44036) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taOpG-00029b-QF for 75636@debbugs.gnu.org; Tue, 21 Jan 2025 19:42:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737506547; bh=5j2tvjQjVcHmOp3/X+RVyTjaWcqs2hiOXDsBjaA/XgI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=pqrwlpqY/ZLnHPreAwSN3XNm1eU1/YrtLdjYu/fr7RP3AgdF3b59vOYdRTnJl0AEMC+wY0GXoS2rXNmcIuENn7L5XudFTxsJh2TgPdqPmHe9MXPDm5grnfwFThIArYFUEQYIHbPC3YNroPS10UP5NjaEpCA9UVUztNsqlYzLKOJ3Cn2I2KDVUhvk4KEzvsYMCiamZ7DgJsGoYy8AbEMfgKNo6MbeRwA/VjXjLmv3tBSKNItDlqLvHsKLYLYu2gp/yAakXzEXDfxXymD6upHxxT0SHtWm33Q6NrIlYeZJqyVFl5hJF27OgjPkY/mkOy1fMwnL6LT3F6Rx3wIdAsaLsQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1737506547; bh=IGx2k52yxTVIVImhz66oZFnngJuAci619TRo+5fEq/V=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=OSGvOcUdjiamoaa7INpTNhhadJq+SOrrXZHaufMmp335ujAdhR4LdvZusUIfEAeSef2MgJtmR+IwPjUM+OUEGet0YvNJFlMw7p1ppK6E6n6h6KzAwr1bWS+SdfCsRAKLRj9N0u0IUaL4LcWFlbbi1rnmC+eEzRuVID4H9WcRmCg7veVFPAYpHp1/RolIgMyQvoqw/d/zx4aBGauC+vtPk6X75vbvYXj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Bahsq3xUrRytMFXIgXF8QpXvP4 SH9Sf0E1eI8bed.2HrCWoNsybglbd_l_GQ4YCRJXdEHKqExDk0_yvAAmoBTHwebJHTpo6F.1lAhu gxOylxosQOe3Ev7.59a6mlzsgMw2JgmJB72Mv_RucFPmEFv_28V8yAeydSgEO6x0EebZxLVQS2cE urbSuLiT.XrCRG9WioYRudgK6X_3NFKe6HIQOJ4CkaZJvUB0B4BSJUy2QJJZveypsvbVwcv1Dk2i rtitHWEqCLHhE3ihO.hUcOXdq6u4ZC1uaOcZIcYjVVlNIn9hyEsRq1wc- X-Sonic-MF: X-Sonic-ID: 73bad831-af0c-46ed-90f9-a77817791456 Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Wed, 22 Jan 2025 00:42:27 +0000 Received: by hermes--production-sg3-5b7954b588-bfzf8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9057f0e600022db6847204b2db5fa4b1; Wed, 22 Jan 2025 00:42:23 +0000 (UTC) From: Po Lu In-Reply-To: <877c6ol89s.fsf@protonmail.com> (Pip Cet's message of "Tue, 21 Jan 2025 11:24:21 +0000") References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> <877c6ol89s.fsf@protonmail.com> Date: Wed, 22 Jan 2025 08:42:18 +0800 Message-ID: <87jzanznkl.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23187 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 3492 X-Spam-Score: -0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) Pip Cet writes: > "Po Lu" writes: > >> Pip Cet writes: >> >>> "Po Lu" writes: >>> >>>> Pip Cet writes: >>>> >>>>> Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently >>>>> leaks some memory, particularly when using tool bars. >>>>> >>>>> 1. The input "multicontext" created by: >>>>> >>>>> imc = gtk_im_multicontext_new (); >>>>> g_object_ref (imc); >>>>> >>>>> is only unref'd once when destroying the frame. This leaves the >>>>> refcount at 1 and leaks the object. >>>> >>>> Strange, I was under the impression that IM contexts descended from >>>> GInitiallyUnowned. Evidently they don't, and as such, removing the >>>> g_object_ref will suffice. >>> >>> Thanks! I'll just do that, then? I think it's okay only to do it on >>> master, as it's a minor bug in the !HAVE_MPS case. >> >> Sounds good to me. >> >>>>> 2. free_frame_tool_bar is never called in my experiments, so the toolbar >>>>> widget isn't destroyed. >>>> >>>> It is only supposed to be called when a frame's tool bar is disabled. >>>> while it is x_free_frame_resources that should release all resources >>>> when a frame is to be destroyed. >>> >>> Thanks! I'll come up with a patch and discuss it further for this one, >>> because it's not quite trivial. >>> >>> Pip >> >> Thanks. > > This showed up during testing, but might ultimately have been because I > deleted the new frame too soon. I can only reproduce it on the > feature/igc branch, but that might be because the timing is different on > that branch. > > When we create the initial tool bar, f->tool_bar_items is still Qnil. > In that case, we don't pack the toolbar widget, but create it and > connect signals to it. > > xg_free_frame_widgets does not explicitly delete the toolbar, which > works only if it's packed and destroyed implicitly. > > I think this is right, and the bug isn't reproducible on the master > branch only because of timing differences: > > commit 5ed4aaa986dbf75f8565f4d8cdd3d1d1b38b6142 (HEAD) > Author: Pip Cet > > Destroy GTK tool bar widget if it was never attached (bug#75636) > > * src/gtkutil.c (xg_free_frame_widgets): Call gtk_widget_destroy on an > unpacked toolbar widget. > > diff --git a/src/gtkutil.c b/src/gtkutil.c > index 0e9dd4dfe11..97582a524da 100644 > --- a/src/gtkutil.c > +++ b/src/gtkutil.c > @@ -1885,6 +1885,12 @@ xg_free_frame_widgets (struct frame *f) > if (tbinfo) > xfree (tbinfo); > > + if (x->toolbar_widget && !x->toolbar_is_packed) > + { > + gtk_widget_destroy (x->toolbar_widget); > + x->toolbar_widget = NULL; > + } > + > /* x_free_frame_resources should have taken care of it */ > #ifndef HAVE_PGTK > #ifdef HAVE_XDBE LGTM. > I think this second patch might also avoid future compiler warnings: > > diff --git a/src/gtkutil.c b/src/gtkutil.c > index 97582a524da..73e9f778c75 100644 > --- a/src/gtkutil.c > +++ b/src/gtkutil.c > @@ -6123,8 +6123,7 @@ free_frame_tool_bar (struct frame *f) > else > gtk_widget_destroy (x->toolbar_widget); > > - x->toolbar_widget = 0; > - x->toolbar_widget = 0; > + x->toolbar_widget = NULL; > x->toolbar_is_packed = false; 0 as the rhs of an assignment to a pointer variable is taken for a NULL pointer, so there's no issue with the existing code. Indeed on many systems NULL is simply defined to 0. From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jan 2025 01:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.173750802414558 (code B ref 75636); Wed, 22 Jan 2025 01:08:01 +0000 Received: (at 75636) by debbugs.gnu.org; 22 Jan 2025 01:07:04 +0000 Received: from localhost ([127.0.0.1]:58410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taPCx-0003mi-U3 for submit@debbugs.gnu.org; Tue, 21 Jan 2025 20:07:04 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]:21873) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taPCu-0003m1-Dp for 75636@debbugs.gnu.org; Tue, 21 Jan 2025 20:07:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1737508012; x=1737767212; bh=VaXqXXXJMbKgdP+NNbMz3VNrxjV2xq7os8+sQOlqdvI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=gzbKHuUK5ugCD0ATT6oGGNVsXqnA0GqDm6pteFGqGN1a9tyLxVyCyuqbVNois81Tx OLxIw3Q5jrm5keOw2kR97MC57wjpMetyMim468EYGRxsNqcJV0Clnxe1dIdbKjfdzc toDBzEh6U7ozIwqGbA3Av/9vDHhlqzLg/83akAgKn1/gucjW35NEIQQaHoL/C6uH9g ZQ4eNLh7H9UdEXfwIemBlxjQnmjAzvNj9Q+L0DvKSPmwcgsAaw4gQEyzNlaLCP/i5M pCxpdcqpXSC37oMxL83E0zbx0EgCxDl8Kbbx+2QWtJajybaURNQVr8fOswza+4UuNH jXd/iqcf0EJ/w== Date: Wed, 22 Jan 2025 01:06:49 +0000 From: Pip Cet Message-ID: <87r04vlkrj.fsf@protonmail.com> In-Reply-To: <87jzanznkl.fsf@yahoo.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> <877c6ol89s.fsf@protonmail.com> <87jzanznkl.fsf@yahoo.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 68330659f80fdb59d355c9cc59aed5000ef8bcc1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Po Lu" writes: >> commit 5ed4aaa986dbf75f8565f4d8cdd3d1d1b38b6142 (HEAD) >> Author: Pip Cet >> >> Destroy GTK tool bar widget if it was never attached (bug#75636) >> >> * src/gtkutil.c (xg_free_frame_widgets): Call gtk_widget_destroy on = an >> unpacked toolbar widget. >> >> diff --git a/src/gtkutil.c b/src/gtkutil.c >> index 0e9dd4dfe11..97582a524da 100644 >> --- a/src/gtkutil.c >> +++ b/src/gtkutil.c >> @@ -1885,6 +1885,12 @@ xg_free_frame_widgets (struct frame *f) >> if (tbinfo) >> xfree (tbinfo); >> >> + if (x->toolbar_widget && !x->toolbar_is_packed) >> +=09{ >> +=09 gtk_widget_destroy (x->toolbar_widget); >> +=09 x->toolbar_widget =3D NULL; >> +=09} >> + >> /* x_free_frame_resources should have taken care of it */ >> #ifndef HAVE_PGTK >> #ifdef HAVE_XDBE > > LGTM. Thanks, pushed. Just to clarify why I suspect this is more important than it looks: on the feature/igc branch, a leak like this means the frame and all objects referenced by it will become unfreeable. The problem is not the GTK memory usage, it's that MPS has no way of indicating "if this object is still alive, don't move it" without simultaneously keeping it alive. (At some point we might allow the frame to be moved even though GTK owns a pointer to a pointer to it. After the merge...) >> I think this second patch might also avoid future compiler warnings: >> >> diff --git a/src/gtkutil.c b/src/gtkutil.c >> index 97582a524da..73e9f778c75 100644 >> --- a/src/gtkutil.c >> +++ b/src/gtkutil.c >> @@ -6123,8 +6123,7 @@ free_frame_tool_bar (struct frame *f) >> else >> gtk_widget_destroy (x->toolbar_widget); >> >> - x->toolbar_widget =3D 0; >> - x->toolbar_widget =3D 0; >> + x->toolbar_widget =3D NULL; >> x->toolbar_is_packed =3D false; > > 0 as the rhs of an assignment to a pointer variable is taken for a NULL > pointer, so there's no issue with the existing code. Indeed on many > systems NULL is simply defined to 0. The issue with the old code (I've pushed this part by now) was the duplicated assignment. I think compilers will start to warn about that much sooner than about the correct (if very, very slightly deprecated) usage of plain 0 here. Pip From unknown Mon Aug 18 09:07:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Pip Cet Subject: bug#75636: closed (Re: bug#75636: GTK memory leaks) Message-ID: References: <87o6zl9r9v.fsf@protonmail.com> <87sephfb9k.fsf@protonmail.com> X-Gnu-PR-Message: they-closed 75636 X-Gnu-PR-Package: emacs Reply-To: 75636@debbugs.gnu.org Date: Sat, 01 Feb 2025 23:32:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1738452722-32680-1" This is a multi-part message in MIME format... ------------=_1738452722-32680-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #75636: GTK memory leaks which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 75636@debbugs.gnu.org. --=20 75636: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75636 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1738452722-32680-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 75636-done) by debbugs.gnu.org; 1 Feb 2025 23:31:32 +0000 Received: from localhost ([127.0.0.1]:60420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teMxY-0008U8-Aj for submit@debbugs.gnu.org; Sat, 01 Feb 2025 18:31:32 -0500 Received: from mail-10628.protonmail.ch ([79.135.106.28]:17951) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1teMxV-0008To-NJ for 75636-done@debbugs.gnu.org; Sat, 01 Feb 2025 18:31:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738452683; x=1738711883; bh=7Atqkq4rqnQTfsJikLBeAH/02nM8Jx0MT0AKLt97YrI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=En6ow6wDloOqKlKiEFeDxzqr3vs3Cmcz3cGHjxV2ymsl+TtWS3D6X3t4KyJKj16E1 qr4VE60+2xI/U6E99TPXANRpfBQnD23lSyVtbkbqNhzjtQBJU54GAxuIwvLUL4fnUT rppFvqWYViFTP2iImzTGcUhuJCERbQUILeZMvXaT+demPv+5e3TvUtb5cDsKn0SsKN cmzdrGJ8kNWP0NspK7P2Hs2ka6qXUjp5BRQW8mxG2eWTgU6PRkADcJOAShNkCHb3b4 ZtaMJiwL5PqtpRAMm3CaSYldZdLfwfvXVUs/+Nw/PcpNMRPmwdOL5shm8CrdogGiKn /uwpND/ZW1Mpg== Date: Sat, 01 Feb 2025 23:31:19 +0000 To: Po Lu From: Pip Cet Subject: Re: bug#75636: GTK memory leaks Message-ID: <87o6zl9r9v.fsf@protonmail.com> In-Reply-To: <87jzanznkl.fsf@yahoo.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> <877c6ol89s.fsf@protonmail.com> <87jzanznkl.fsf@yahoo.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: aabf1b04bfeaae3966de217199129a9859a0dcce MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75636-done Cc: 75636-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pip Cet writes: > "Po Lu" writes: > >>> commit 5ed4aaa986dbf75f8565f4d8cdd3d1d1b38b6142 (HEAD) >>> Author: Pip Cet >>> >>> Destroy GTK tool bar widget if it was never attached (bug#75636) >>> >>> * src/gtkutil.c (xg_free_frame_widgets): Call gtk_widget_destroy on= an >>> unpacked toolbar widget. >>> >>> diff --git a/src/gtkutil.c b/src/gtkutil.c >>> index 0e9dd4dfe11..97582a524da 100644 >>> --- a/src/gtkutil.c >>> +++ b/src/gtkutil.c >>> @@ -1885,6 +1885,12 @@ xg_free_frame_widgets (struct frame *f) >>> if (tbinfo) >>> xfree (tbinfo); >>> >>> + if (x->toolbar_widget && !x->toolbar_is_packed) >>> +=09{ >>> +=09 gtk_widget_destroy (x->toolbar_widget); >>> +=09 x->toolbar_widget =3D NULL; >>> +=09} >>> + >>> /* x_free_frame_resources should have taken care of it */ >>> #ifndef HAVE_PGTK >>> #ifdef HAVE_XDBE >> >> LGTM. > > Thanks, pushed. While GTK remains very slow due to MPS limitations and the way we work around them, I'll file a new bug when we have a way around that, and closing this one. Thanks! Pip ------------=_1738452722-32680-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 Jan 2025 20:15:27 +0000 Received: from localhost ([127.0.0.1]:38926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tYskZ-0004Xp-1i for submit@debbugs.gnu.org; Fri, 17 Jan 2025 15:15:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:54460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tYskX-0004XF-4y for submit@debbugs.gnu.org; Fri, 17 Jan 2025 15:15:25 -0500 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 1tYskO-0006dz-OV for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2025 15:15:16 -0500 Received: from mail-10629.protonmail.ch ([79.135.106.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tYskJ-0006nJ-NY for bug-gnu-emacs@gnu.org; Fri, 17 Jan 2025 15:15:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1737144909; x=1737404109; bh=AHmX5Uv8++wycBvmI08q5yQ0ctE6pAgXYMJ5f1jo0K4=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=b5Dq9TGmTtZXYtl3msGQlSKVgNozH5vdVI3WQoo1tFxW3SRY7X19ZHySGcbLy38tS AZyv+eEuQ4UtkxNKZZfbUCf0LMIw5lvdvnoYJbsxwd/fqw09vfEr+ip+AFT5osJIuk By1eYGU7PQaCPmtU+sUwrW5zL0m9mgIFuO8hCCZaGVDo8gwMLbY9lvuwT1ZAKgPVrH ufoByNshNyreGPn1wVfcs6WRCgqp86i42kkGsDclmtq1P/mUo+0okYnKdazrUiHz/Z pmd2Kn9SmFb6QvE/d9CzHvQr1CqnXNgG/UIyoWyLICiAVFN+LcgnXmNn9Qk0kNLii4 3d4uPqGErvXCg== Date: Fri, 17 Jan 2025 20:15:02 +0000 To: bug-gnu-emacs@gnu.org, Po Lu From: Pip Cet Subject: GTK memory leaks Message-ID: <87sephfb9k.fsf@protonmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: f97a4e3f8014fb81db43b64cfe6a85b1f86b671c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=79.135.106.29; envelope-from=pipcet@protonmail.com; helo=mail-10629.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Creating and destroying GTK frames (using gtkutil.c, not PGTK) currently leaks some memory, particularly when using tool bars. 1. The input "multicontext" created by: imc =3D gtk_im_multicontext_new (); g_object_ref (imc); is only unref'd once when destroying the frame. This leaves the refcount at 1 and leaks the object. 2. free_frame_tool_bar is never called in my experiments, so the toolbar widget isn't destroyed. This isn't usually a problem because it's just a small memory leak, but on the feature/igc branch, user data passed to glib must be protected in a special GC root structure; such structures accumulate when running in GTK, eventually reducing GC performance significantly. Unfortunately, valgrind doesn't seem to catch these memory leaks. ------------=_1738452722-32680-1-- From unknown Mon Aug 18 09:07:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75636: GTK memory leaks Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Feb 2025 21:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu , Pip Cet Cc: 75636@debbugs.gnu.org Received: via spool by 75636-submit@debbugs.gnu.org id=B75636.17386189197118 (code B ref 75636); Mon, 03 Feb 2025 21:42:02 +0000 Received: (at 75636) by debbugs.gnu.org; 3 Feb 2025 21:41:59 +0000 Received: from localhost ([127.0.0.1]:41616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tf4Cc-0001qj-NW for submit@debbugs.gnu.org; Mon, 03 Feb 2025 16:41:58 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:43032) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tf4Ca-0001qR-Kv for 75636@debbugs.gnu.org; Mon, 03 Feb 2025 16:41:57 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d9837f201aso11090988a12.0 for <75636@debbugs.gnu.org>; Mon, 03 Feb 2025 13:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738618910; x=1739223710; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=tVT6+Rg7I3HS46r+/sehIXfrqPvJaA1PP5i5Oc0QMbQ=; b=XvYN7VjPXt5xHukk2Oq8JHc89daMrgqKN1lXAL7iElyo6hJu8ARG8pFtfYc73N/Y4e N+6wgoDjvJ08nyqvjHHTBGm4NtV5SZs32G8ATKG1gOdCEAN3ErS5e4jXzJV33c5QKxS4 8wO4MopX1KtfIen0QOlrHm2zJcHqQ2MC50jBz5GQJmM9IPSFYj5EhHJXULGeQrl6Q5Mb Imlt7YIr8k1Lixi+01HPOuwhfV/meEVChd3ybv6XxaYc9FvK2P+S/eo3v85sFYEz+vCG M62UgJ4ddBhSF+Fx1tXWr0eZnLbGN0D6foF80MObMySjpfOENVeln/mF/j+F52Zkilux /m4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738618910; x=1739223710; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tVT6+Rg7I3HS46r+/sehIXfrqPvJaA1PP5i5Oc0QMbQ=; b=Kv6bqZLdXI2dUWk8kMFg2cw8/DfrzKES/1KN4eDJfrxMJyz9VOYFQejaNnDJX+ateX wFCaWQWPvNdhs+B+/D9kav5MrztO1W73cC1qK8hQIbhhgUoXrgHytsYZqlCU90bCUFKa n35EE3QqGI4plQqjwJIyXDwy3PkW+L3m2O7V791dAOUsANN4GOQ3LpOSReW5IyOrkQcC ASJ6mvuZIEudHbvYarL93VT6LC4ckOvlYq2YkdXmxeRMh5ZR+98Wlr83l2BYSz9xKRr2 iLOboRiKGJORpACGFTsNSZvVW/KlfKt4E2NVrI2kmk7EzLPnFJFuED4zMctRw8/9+BL/ ETWA== X-Gm-Message-State: AOJu0Yyi2Fv1IHQL+ibkh7UMLZViOFlUkDAd2n+xrq4Xcg7YYtFHyGjX jg7Ec6fvdSWrlg3LcvLMjais9vXpAJ6O3uTQnj15W/iQgYHkUDSr2QZz+RMIFcte8b0UNZV6YZv ZXr1OsYZCGMWSwIXWv8zS+1/iX0A= X-Gm-Gg: ASbGncuOeWINDmEBh3/+aoeEU9oeafOgHc2Al0rRPflW2v+E9dg/+AMf/6de/ipofs5 zkcDk84nKp+a5b5EtJXMeXNMDPMyN/J/YtQJQcFNQ0DYZcTV/RVaXsyj/7Tk5bfQifVx8g0Umi2 U= X-Google-Smtp-Source: AGHT+IF/D/12wHTCWNukAeg1LVoyd2Yw3EMw/6Dc/JcPESVNSUa0EEHNcYXpIx7/M9Dy0ITluRg/aSaPefIV4N3YEcs= X-Received: by 2002:a05:6402:254e:b0:5d9:6633:8eb1 with SMTP id 4fb4d7f45d1cf-5dcc15d5a63mr947514a12.14.1738618910322; Mon, 03 Feb 2025 13:41:50 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 3 Feb 2025 13:41:49 -0800 From: Stefan Kangas In-Reply-To: <87jzanznkl.fsf@yahoo.com> References: <87sephfb9k.fsf@protonmail.com> <87r0501o9j.fsf@yahoo.com> <87sepgcpey.fsf@protonmail.com> <871pwz1v5d.fsf@yahoo.com> <877c6ol89s.fsf@protonmail.com> <87jzanznkl.fsf@yahoo.com> MIME-Version: 1.0 Date: Mon, 3 Feb 2025 13:41:49 -0800 X-Gm-Features: AWEUYZmYYixKSQDn35BRjLkZbZchzDDvq2tiGl8wpoqUtnI2eogcr2nfunwzFI4 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > 0 as the rhs of an assignment to a pointer variable is taken for a NULL > pointer, so there's no issue with the existing code. Indeed on many > systems NULL is simply defined to 0. Both are valid C and compilers won't complain, but it is better to use the correct type. This means using NULL as the rhs for pointers. Conversely, we should _not_ use NULL as the rhs if not assigning to a pointer. Compilers will warn about that one, though.