GNU bug report logs - #56462
29.0.50; [PATCH] Memory leak in ns_draw_relief

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Daniel Martín <mardani29@HIDDEN>; Keywords: patch; dated Sat, 9 Jul 2022 14:14:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 11 Jul 2022 10:25:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 11 06:25:52 2022
Received: from localhost ([127.0.0.1]:38401 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAqbw-0006MQ-78
	for submit <at> debbugs.gnu.org; Mon, 11 Jul 2022 06:25:52 -0400
Received: from sonic312-23.consmr.mail.ne1.yahoo.com ([66.163.191.204]:43311)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <luangruo@HIDDEN>) id 1oAqbu-0006M9-A7
 for 56462 <at> debbugs.gnu.org; Mon, 11 Jul 2022 06:25:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657535144; bh=kWebO08RdHsXohVonEv7LqLLlFo1dcxaqFzAodBk6uo=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=Id/AbXM76b7uy76JhBVUoQbe7s89nP2mQKKKKkjab93LONUu2hbYwXMmUP3evH+ilpQiybDmnxkdo/gjrqnYGFT6hZSgEsVP5EcorHnPFVsp9WWfBzpLqUpukNoCkNw4cqK9oe7gbja56zZFqZMmiES6o3NgxCbYQC+r2gBxPrqFBqa81lOx8REPs1Gnnh4KiNUA+ntwuovE33OO5mAawHJpPFap6gVvC9fTpikFnFzLiEua/i+np4tdn7nosgBDZWh9cFcm4hfM0nn2/2afJ0EE5pHMA+QJWjLQzy8cvLH14v79RFBbWTTy+K+wtQyZPhTtes7FTG/Vuhn3AtRAXw==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657535144; bh=MtfSe2VXeEW8EgQgdJM8wjZezdAURzfPq5vLry6aoNv=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=G9sBTTPE2tm5Pd8MKJUkYVmkhY5EuopRFBvEZga8aFNlHS3w3W333DEMIDsehccyLlNVv+zPebKi1brFRKEI7vjf/nMDgF4zKTbBAtzORb77andYPYeYlcxKf5g9BSv2PLf09rFMiffnRVYlTNA+Gpm3ukvjhtCWfTicHo94bWThkAjbn5l6A59qkIuvhQihKwVZSMgZPyE1qXBKhiLB5pktg8vBKkogM+ZLmTh96As3uvHNUeRazUcUD6iD5VFG1ZXno3A27iHWSbvZ05FDRQxK3ah2JSrcCtevq9HGkvW82einBAZ397FGl3S0l7eQA0YD3OEhG602FQ1LfNlQPQ==
X-YMail-OSG: FQ8JT1IVM1khcNICTel5fHO8dgxfOimuDR9kgwlgVH2LD.7UlNY8u307hsPxdlU
 GdnYbCzDgPqeFGlYSglDMVATJyKDmwD7m_WXmsgg84hCS5kBR5kh6bNep4GaP7XEjIVhtLwuwi2e
 Gkoocv8K41AHV4Sded5KHwk3wq241jklOUqhbuFJSjH1bJXtljdV8zrDl0iHu4Q3SccX2gKfdQYF
 EXri4sZ5SuZZ9Eac0MtzSVR.lzb5hhN9G.SSjoDIwyPJDAfIBCRus0L7lVf7UOr5P2wyxub2_DhY
 SRiI91jb.SC_OWxIBWqlzIOTeoPCvICZjEX2lbYo24NheXL3QoQ.8B7MLG5rUEh3ue8uT1aYgZEJ
 W_nzPi2WvdTM_fePMe9XFD3iR7TYl8.48oj4S32ij5nyb8ToWlJdV0tW36eYFCNf0j_xB64Q3l2G
 glq_3GO7ygJj3yxOAYHw.iUOYz266.WM_MqJ9EYap0PH3XbsuPVwvoVUCJ1Ha9lUPVJxjS00w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DG95NejzdusVU6ws9RHU7AZeTpjdN7
 a3K255NQ0mSNiIswjIBuqzfRuUvhfhG0aawaHanFIFygWmI1HiC4lCWWvxJmYcZTkrqwkYYnanuy
 VY1nwnx1YMLvmD.rvvHplB87J5Mv1Drq.lCIcfKYJY1N72Vz_GeJZdMuMSu6hRcdT3NOVu78mnj7
 5shNxsWDUqiOkPSD78ABHDH2mnhuTQeDwyz05b7b5xd6o7IVEQMJh5p4_NY3jbf6VrovCXMn.r3k
 KA75Ok7W6fSrU5tZ01fgreWWFug__5iMbpE8Hk_A6cpQQILI2V5qw.qB4IoZuo1HXFq2.R8GVPNC
 wG3FGmbqd0_fr2AQCYEKkqSriTFjjsNSu48iZFYa8WwdhvZJRyx1OhP2iwq65uwcSC0qDUIUCNcf
 KX_NdxnU7EkxIcCz5ccq055vSRLN3EB7GPFbOsvJJN4a4hwgtNReoDAhLMtT1O6i2jyBZs.VnhhP
 ygl_GmHJABJsfVLwoyHv_Jx7Ak5w_u.mBrERMV0IO3t0xl4v48S7TeqzkIK1oso2FgoWnZRNqST8
 FI_2NfnBX4wrmCEHsAGHtcjq.1IwewUvePwJss4yE1JXjFuMBb7d4Igj08_x_WtltNUOZGzLRbVR
 tZ3ruoj1ZB.t8AtT.PMbA4yC0d2lBldrCJ.jgueCKgEL4GZ2RGD4GzKQX8Kk02n.Y8az3kxlejv3
 gwq9urtp7wEJCI4JGP2nHUlGDBDVQQ.kdY_qVbPD5dBcK6dTyeoQbfTom0WTI_Irk
X-Sonic-MF: <luangruo@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic312.consmr.mail.ne1.yahoo.com with HTTP; Mon, 11 Jul 2022 10:25:44 +0000
Received: by hermes--canary-production-sg3-67975bbd4b-qg7qj (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 15bd29704b2839bf4bca6e26d291abfc; 
 Mon, 11 Jul 2022 10:25:39 +0000 (UTC)
From: Po Lu <luangruo@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= <mardani29@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN> <m1k08lxngj.fsf@HIDDEN>
 <m11qusy9l3.fsf@HIDDEN>
Date: Mon, 11 Jul 2022 18:25:35 +0800
In-Reply-To: <m11qusy9l3.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?=
 message of "Sun, 10 Jul 2022 22:52:08 +0200")
Message-ID: <87k08kymhs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 602
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 56462
Cc: 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Daniel Mart=C3=ADn <mardani29@HIDDEN> writes:

> Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>>>
>>> Thanks.  But I think the use of static variables there is rather ugly,
>>> and it would be much nicer if we replicated the `x_setup_relief_color'
>>> logic there.
>>>
>>> Do you want to work on that, or should I?
>>
>> Thanks, I can give it a try.
>
> Here's a patch where the static variables are now proper fields in the
> ns_output structure.  Is that what you had in mind?

Now installed, so I'm closing this bug.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 11 Jul 2022 08:01:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 11 04:01:10 2022
Received: from localhost ([127.0.0.1]:38192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAoLt-0006EK-Rb
	for submit <at> debbugs.gnu.org; Mon, 11 Jul 2022 04:01:10 -0400
Received: from outbound.soverin.net ([185.233.34.21]:42643)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alan@HIDDEN>) id 1oAoLo-0006Df-5X
 for 56462 <at> debbugs.gnu.org; Mon, 11 Jul 2022 04:01:08 -0400
Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits))
 (No client certificate requested)
 by outbound.soverin.net (Postfix) with ESMTPS id 4LhGXn4Q09zPP;
 Mon, 11 Jul 2022 08:00:57 +0000 (UTC)
Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin;
 t=1657526457; bh=m7Um2mBXlAVJSADaIV/MhuesxyVxGpB0csVwVy6YG+g=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=b0AoUw5OEJy/GIFIRQ4wUx2PBsCHSA91EHPLh49WS3nrHPmHI0q/zcEjkucm4h1S/
 raXNaaUZ3dSD6XmtMZETRntrDE1lPxf1Mcx0RxCnaJG5iTSdQQVLhYoKSyGx1hUEUb
 CUTek+zNMVE9phIxsQz0ZVUAZ8yMVWa5kONZmRYVwG31OCPiB9XbjL37qWF1paqPrx
 dPYDZEv3GnwU+f6gnlfJqheOxuSQx4VZPKUoQLbj0qN4qGzPOe+wli16PC+wa5d5Jh
 YZYdMxsHKafhFt38mNimmj5EC78UDl8k5gZMET8BvB3HOZT6BfefpF9MA0/o0AqnTn
 LfYDKx4DiRsFA==
Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95)
 (envelope-from <alan@HIDDEN>) id 1oAoLr-000GYS-St;
 Mon, 11 Jul 2022 09:01:07 +0100
Date: Mon, 11 Jul 2022 09:01:07 +0100
From: Alan Third <alan@HIDDEN>
To: Po Lu <luangruo@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
Message-ID: <YsvYw+5aulv3scjI@HIDDEN>
Mail-Followup-To: Alan Third <alan@HIDDEN>, Po Lu <luangruo@HIDDEN>,
 Daniel =?iso-8859-1?Q?Mart=EDn?= <mardani29@HIDDEN>,
 56462 <at> debbugs.gnu.org
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN> <m1k08lxngj.fsf@HIDDEN>
 <m11qusy9l3.fsf@HIDDEN> <878rp01kq4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <878rp01kq4.fsf@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 56462
Cc: 56462 <at> debbugs.gnu.org,
 Daniel =?iso-8859-1?Q?Mart=EDn?= <mardani29@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon, Jul 11, 2022 at 09:50:11AM +0800, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
> Daniel Martín <mardani29@HIDDEN> writes:
> 
> > Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of
> > text editors" <bug-gnu-emacs@HIDDEN> writes:
> >
> >>>
> >>> Thanks.  But I think the use of static variables there is rather ugly,
> >>> and it would be much nicer if we replicated the `x_setup_relief_color'
> >>> logic there.
> >>>
> >>> Do you want to work on that, or should I?
> >>
> >> Thanks, I can give it a try.
> >
> > Here's a patch where the static variables are now proper fields in the
> > ns_output structure.  Is that what you had in mind?
> 
> Yes, this would be great.  Thanks.
> 
> Alan might have some comments; if he doesn't, I'll install this now.

No, looks fine to me.
-- 
Alan Third




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 11 Jul 2022 01:50:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 10 21:50:30 2022
Received: from localhost ([127.0.0.1]:38048 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAiZC-0004jZ-LY
	for submit <at> debbugs.gnu.org; Sun, 10 Jul 2022 21:50:30 -0400
Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]:44995)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <luangruo@HIDDEN>) id 1oAiZA-0004jA-3c
 for 56462 <at> debbugs.gnu.org; Sun, 10 Jul 2022 21:50:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657504222; bh=9GFFEfSiyg8ia0rH3WtToYmMzxYcpFFp+wAif+9k+5o=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=QZwzFL9muvlkuPZU2P/0vhzHzx7DBKhk50sFL5HS4lrCZzf0z6hGFIDwB994PrtviYiGlGEYitZJ986oDqxFUwmvF/YzR6cecsnwmyHgr8E3Nbtw5LGinddLxfRbFikbmyaekseVzZOh0Qf6BKEgaBXCTMSO454vhnbpwmLeuDp0589X1Wn9XidjbjIwXIunyHOe9iTh39e/dH8AOz/ohd5QJ9rDsxiwCiHhWF9GqLPzRsUnfITpXAiDlxqvivLx3Wgi+NLPrBXAlmlcRgS7qMm2+7KG0VivEjRiLBUcuHT8r/6ihq8rthdcqzlvF3Nfz/nTZFnreSxNjAZZEtdfMg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657504222; bh=SHAEr6CcTAAKFxyldfL2qerKLVPiEL9U/eAoHOeXr1b=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=rJQBL3beb/XJRXVZ+LFc3SNuNvsFKQtln7g/u9/fgM6JhgsAxVHAdTbhwdeKjBVNE2PGzdPdv6z7B3+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OOxAfSOu79X2oM5OGIwviyAfoSNNQ0cYHqJZquoDpL9Emr4Qa1UDQZCQ2YE27Z02tI0Asb3dm
 hpiVlT_rcJf8wdrIEsvpLa4QcQHdvjvr8WqSS49eGDoYvGDPfbMCh6x71ld83Som157icpny2_7Q
 ptbQwLDUQgSc.K8r3uU7SseUMaqAek7zv4rY6CGfLzxBxhr4eIogomra_kvIllQ9JXe8583_MmsV
 7GB7rPwG3aZfzDaX6HPyjulenNLh5isj6fVnFI8sxQrgISBNKVFU7snWZnU7qOF2miqCoDTLF87S
 qa.EO6Aq81XGJbChxSsOjTjfNGOfuNTXF.rwjf5_Fl4XCtelxNvo9i_VViZJtq0Zhfj9w9Ij53oZ
 LoQumGzdUsx8w9f9PMDKe9a32mKg5K598ZqkMhEC3tEkirRDaB8g1B.YMk1t9H5MjIpaVUIjqXDC
 32cP9foDLKbby...c9BI_6zqdaxng3YlBgAaboAxMup_qCIUKRX8OKLxp3.FoPQ--
X-Sonic-MF: <luangruo@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic313.consmr.mail.ne1.yahoo.com with HTTP; Mon, 11 Jul 2022 01:50:22 +0000
Received: by hermes--canary-production-sg3-67975bbd4b-5klrh (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 31d65b5fe73489dbf23fd7118eb496d0; 
 Mon, 11 Jul 2022 01:50:16 +0000 (UTC)
From: Po Lu <luangruo@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= <mardani29@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN> <m1k08lxngj.fsf@HIDDEN>
 <m11qusy9l3.fsf@HIDDEN>
Date: Mon, 11 Jul 2022 09:50:11 +0800
In-Reply-To: <m11qusy9l3.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?=
 message of "Sun, 10 Jul 2022 22:52:08 +0200")
Message-ID: <878rp01kq4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 667
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 56462
Cc: Alan Third <alan@HIDDEN>, 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Daniel Mart=C3=ADn <mardani29@HIDDEN> writes:

> Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@HIDDEN> writes:
>
>>>
>>> Thanks.  But I think the use of static variables there is rather ugly,
>>> and it would be much nicer if we replicated the `x_setup_relief_color'
>>> logic there.
>>>
>>> Do you want to work on that, or should I?
>>
>> Thanks, I can give it a try.
>
> Here's a patch where the static variables are now proper fields in the
> ns_output structure.  Is that what you had in mind?

Yes, this would be great.  Thanks.

Alan might have some comments; if he doesn't, I'll install this now.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 10 Jul 2022 20:52:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 10 16:52:22 2022
Received: from localhost ([127.0.0.1]:37843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAduf-0005Vz-RI
	for submit <at> debbugs.gnu.org; Sun, 10 Jul 2022 16:52:22 -0400
Received: from sonic310-11.consmr.mail.ir2.yahoo.com ([77.238.177.32]:45209)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1oAdud-0005Vk-OU
 for 56462 <at> debbugs.gnu.org; Sun, 10 Jul 2022 16:52:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1657486334; bh=Uq6dCOcmi+IeL61enwJvPRyhC+mP3VTAzqwD2Ya0UjM=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=pBmIvDZuJfCa5v0UFbuSZ5F03X9n5xXe+Ziy9mdtZqcRGkRRpeOcqH+U4jPRd/lj2i8EuxzHHtIeOpEcHhjoYlPqqjl/BnTc7y1Ou2sGk9CxJrgegii0H3zSqxIWdjnmxpv741qcDTwb8zOCSDuoVuQU9E5aJl2+Rx5hMgU+v5sZRHBN0Vc+u/Z09KtA40mRl5O/AJYkeTV/BuMbIXoehmz4DwT+sJVRZQxqHiL7xP0x8+5+8nJ7O3nojlknpXS72Id2v75h/G1i+Ri0T0ue6HpNVxqh8qxzimjrHsHVKczErKuuWNm6WNECWo7TLYfzElG+HditptmVAoLomeATkA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.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GU6_fb_aDuEywLa1Hu3
 x51XEbjSScEkwmPCrQcz25d6dUzHCiWj6Ko.ZRRtCsKKu7p7qjGutT9DCAInz5klaU.prZd_k5I9
 bTK4VbeSdOzFI3Uwd6KSHBwNy.fDEIY9zdpYgVqkQwHPLR01dc74y4KlYqpZjD_U700T65tk2IEa
 Hz_F6h8yxZvYNJ2Ytf.rEZ_tnt2dhXlE8tX7npepVR9bfrCiP.TVXcjtO7lbsZNKg.PagT0LNQ7h
 fANA2CbGLjO4o9VAo0C37aT.Ss8d2pQ5tvBemjvueFL77k0cewhZVFsr4.O23A2KSs5VOcdh2MNn
 sYeJQ4X2_evqZSLS2uF6XqOcW9y7cVpGly7PQHIQM4JJw2kF49vQN6NOgmV.fvt9SMytV.8fLBfP
 yHShtAANt0OvewpnbZFXIu0xt7SgBXP1fCXQBNRQoHSxgPr2AaJsWhTvuUzZXxYq6.Ss53rcoLN4
 vW_52b91tvWc20m7AnQURK4jrGzYbZrgPsMZ50R4my7DJq1ZRVDWirjFDiMqZ2Z9_JKHHJw7oQI6
 pEOrEytRmQXJviV.VZW7Zp0yOjq3tSfO9dPSx8xVsIT5Vlu_J02cnLOABvwEDPJ_zeSt1PvKogpy
 cppPvElD7mHEXTKP5WsM8u13nGJVfjuzOY.QYkzm2RlMSpPXFLsDCZHaavwX4IYx7vg--
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sun, 10 Jul 2022 20:52:14 +0000
Received: by hermes--canary-production-ir2-74b4d6d794-wvl67 (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 99a352d967dda149c817c5ac624d693c; 
 Sun, 10 Jul 2022 20:52:09 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss
 army knife of text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN> <m1k08lxngj.fsf@HIDDEN>
Date: Sun, 10 Jul 2022 22:52:08 +0200
In-Reply-To: <m1k08lxngj.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn?= via
 \"Bug reports for
 GNU Emacs, the Swiss army knife of text editors\""'s message of "Sun,
 10 Jul 2022 12:37:48 +0200")
Message-ID: <m11qusy9l3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 5468
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 56462
Cc: Po Lu <luangruo@HIDDEN>, 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

>>
>> Thanks.  But I think the use of static variables there is rather ugly,
>> and it would be much nicer if we replicated the `x_setup_relief_color'
>> logic there.
>>
>> Do you want to work on that, or should I?
>
> Thanks, I can give it a try.

Here's a patch where the static variables are now proper fields in the
ns_output structure.  Is that what you had in mind?


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-memory-leak-in-ns_draw_relief.patch

From ebcf7ca3e8a2add11050be4c1d7e991e3c0f0a6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@HIDDEN>
Date: Sun, 10 Jul 2022 22:36:28 +0200
Subject: [PATCH] Fix memory leak in ns_draw_relief

* src/nsterm.h (struct ns_output): New fields to store the relief
colors.
* src/nsterm.m (ns_setup_relief_colors): New function to keep the
relief colors as part of the ns_output structure.
(ns_draw_relief): Remove static local variables.  Assigning them to
nil caused a memory leak of NSColor instances (bug#56462).  Call
ns_setup_relief_colors instead.
---
 src/nsterm.h |  6 +++++
 src/nsterm.m | 68 +++++++++++++++++++++++++++-------------------------
 2 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index 7a097b3248..2a4c7571a3 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -927,6 +927,9 @@ #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
   NSColor *cursor_color;
   NSColor *foreground_color;
   NSColor *background_color;
+  NSColor *relief_background_color;
+  NSColor *light_relief_color;
+  NSColor *dark_relief_color;
   EmacsToolbar *toolbar;
 #else
   void *view;
@@ -934,6 +937,9 @@ #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
   void *cursor_color;
   void *foreground_color;
   void *background_color;
+  void *relief_background_color;
+  void *light_relief_color;
+  void *dark_relief_color;
   void *toolbar;
 #endif
 
diff --git a/src/nsterm.m b/src/nsterm.m
index 7f232e7292..8e0c4b84f0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3475,6 +3475,35 @@ larger if there are taller display elements (e.g., characters
     }
 }
 
+/* Set up colors for the relief lines around glyph string S.  */
+
+static void
+ns_setup_relief_colors (struct glyph_string *s)
+{
+  struct ns_output *di = FRAME_OUTPUT_DATA (s->f);
+  NSColor *color;
+
+  if (s->face->use_box_color_for_shadows_p)
+    color = [NSColor colorWithUnsignedLong: s->face->box_color];
+  else
+    color = [NSColor colorWithUnsignedLong: s->face->background];
+
+  if (s->hl == DRAW_CURSOR)
+    color = FRAME_CURSOR_COLOR (s->f);
+
+  if (color == nil)
+    color = [NSColor grayColor];
+
+  if (color != di->relief_background_color)
+    {
+      [di->relief_background_color release];
+      di->relief_background_color = [color retain];
+      [di->light_relief_color release];
+      di->light_relief_color = [[color highlightWithLevel: 0.4] retain];
+      [di->dark_relief_color release];
+      di->dark_relief_color = [[color shadowWithLevel: 0.4] retain];
+    }
+}
 
 static void
 ns_draw_relief (NSRect outer, int hthickness, int vthickness, char raised_p,
@@ -3486,40 +3515,13 @@ larger if there are taller display elements (e.g., characters
     of some sides not being drawn, and because the rect will be filled.
    -------------------------------------------------------------------------- */
 {
-  static NSColor *baseCol, *lightCol, *darkCol;
-  NSColor *newBaseCol;
   NSRect inner;
-  NSBezierPath *p;
-
-  baseCol = nil;
-  lightCol = nil;
-  newBaseCol = nil;
-  p = nil;
+  NSBezierPath *p = nil;
 
   NSTRACE ("ns_draw_relief");
 
   /* set up colors */
-
-  if (s->face->use_box_color_for_shadows_p)
-    newBaseCol = [NSColor colorWithUnsignedLong: s->face->box_color];
-  else
-    newBaseCol = [NSColor colorWithUnsignedLong: s->face->background];
-
-  if (s->hl == DRAW_CURSOR)
-    newBaseCol = FRAME_CURSOR_COLOR (s->f);
-
-  if (newBaseCol == nil)
-    newBaseCol = [NSColor grayColor];
-
-  if (newBaseCol != baseCol)  /* TODO: better check */
-    {
-      [baseCol release];
-      baseCol = [newBaseCol retain];
-      [lightCol release];
-      lightCol = [[baseCol highlightWithLevel: 0.4] retain];
-      [darkCol release];
-      darkCol = [[baseCol shadowWithLevel: 0.4] retain];
-    }
+  ns_setup_relief_colors (s);
 
   /* Calculate the inner rectangle.  */
   inner = outer;
@@ -3542,7 +3544,9 @@ larger if there are taller display elements (e.g., characters
   if (bottom_p)
     inner.size.height -= hthickness;
 
-  [(raised_p ? lightCol : darkCol) set];
+  struct ns_output *di = FRAME_OUTPUT_DATA (s->f);
+
+  [(raised_p ? di->light_relief_color : di->dark_relief_color) set];
 
   if (top_p || left_p)
     {
@@ -3564,7 +3568,7 @@ larger if there are taller display elements (e.g., characters
       [p fill];
     }
 
-  [(raised_p ? darkCol : lightCol) set];
+  [(raised_p ? di->dark_relief_color : di->light_relief_color) set];
 
   if (bottom_p || right_p)
     {
@@ -3626,7 +3630,7 @@ larger if there are taller display elements (e.g., characters
 				   NSMaxY (outer) - 0.5)];
     }
 
-  [darkCol set];
+  [di->dark_relief_color set];
   [p stroke];
 
   if (vthickness > 1 && hthickness > 1)
-- 
2.34.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Jul 2022 20:52:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 10 16:52:25 2022
Received: from localhost ([127.0.0.1]:37848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAduj-0005WG-9x
	for submit <at> debbugs.gnu.org; Sun, 10 Jul 2022 16:52:25 -0400
Received: from lists.gnu.org ([209.51.188.17]:33152)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1oAduh-0005W8-D9
 for submit <at> debbugs.gnu.org; Sun, 10 Jul 2022 16:52:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58920)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oAduh-0008BH-1q
 for bug-gnu-emacs@HIDDEN; Sun, 10 Jul 2022 16:52:23 -0400
Received: from sonic310-11.consmr.mail.ir2.yahoo.com ([77.238.177.32]:41503)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oAdud-000389-P4
 for bug-gnu-emacs@HIDDEN; Sun, 10 Jul 2022 16:52:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1657486334; bh=Uq6dCOcmi+IeL61enwJvPRyhC+mP3VTAzqwD2Ya0UjM=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=pBmIvDZuJfCa5v0UFbuSZ5F03X9n5xXe+Ziy9mdtZqcRGkRRpeOcqH+U4jPRd/lj2i8EuxzHHtIeOpEcHhjoYlPqqjl/BnTc7y1Ou2sGk9CxJrgegii0H3zSqxIWdjnmxpv741qcDTwb8zOCSDuoVuQU9E5aJl2+Rx5hMgU+v5sZRHBN0Vc+u/Z09KtA40mRl5O/AJYkeTV/BuMbIXoehmz4DwT+sJVRZQxqHiL7xP0x8+5+8nJ7O3nojlknpXS72Id2v75h/G1i+Ri0T0ue6HpNVxqh8qxzimjrHsHVKczErKuuWNm6WNECWo7TLYfzElG+HditptmVAoLomeATkA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657486334; bh=nYYxb8tj0VkNc2VVfYFnMAo4CayGOjSKLiTexUoR/bP=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=pPxD6jDXL3FcwnV1pihq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wNy.fDEIY9zdpYgVqkQwHPLR01dc74y4KlYqpZjD_U700T65tk2IEa
 Hz_F6h8yxZvYNJ2Ytf.rEZ_tnt2dhXlE8tX7npepVR9bfrCiP.TVXcjtO7lbsZNKg.PagT0LNQ7h
 fANA2CbGLjO4o9VAo0C37aT.Ss8d2pQ5tvBemjvueFL77k0cewhZVFsr4.O23A2KSs5VOcdh2MNn
 sYeJQ4X2_evqZSLS2uF6XqOcW9y7cVpGly7PQHIQM4JJw2kF49vQN6NOgmV.fvt9SMytV.8fLBfP
 yHShtAANt0OvewpnbZFXIu0xt7SgBXP1fCXQBNRQoHSxgPr2AaJsWhTvuUzZXxYq6.Ss53rcoLN4
 vW_52b91tvWc20m7AnQURK4jrGzYbZrgPsMZ50R4my7DJq1ZRVDWirjFDiMqZ2Z9_JKHHJw7oQI6
 pEOrEytRmQXJviV.VZW7Zp0yOjq3tSfO9dPSx8xVsIT5Vlu_J02cnLOABvwEDPJ_zeSt1PvKogpy
 cppPvElD7mHEXTKP5WsM8u13nGJVfjuzOY.QYkzm2RlMSpPXFLsDCZHaavwX4IYx7vg--
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sun, 10 Jul 2022 20:52:14 +0000
Received: by hermes--canary-production-ir2-74b4d6d794-wvl67 (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 99a352d967dda149c817c5ac624d693c; 
 Sun, 10 Jul 2022 20:52:09 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss
 army knife of text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN> <m1k08lxngj.fsf@HIDDEN>
Date: Sun, 10 Jul 2022 22:52:08 +0200
In-Reply-To: <m1k08lxngj.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn?= via
 \"Bug reports for
 GNU Emacs, the Swiss army knife of text editors\""'s message of "Sun,
 10 Jul 2022 12:37:48 +0200")
Message-ID: <m11qusy9l3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 5468
Received-SPF: pass client-ip=77.238.177.32; envelope-from=mardani29@HIDDEN;
 helo=sonic310-11.consmr.mail.ir2.yahoo.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Po Lu <luangruo@HIDDEN>, 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

>>
>> Thanks.  But I think the use of static variables there is rather ugly,
>> and it would be much nicer if we replicated the `x_setup_relief_color'
>> logic there.
>>
>> Do you want to work on that, or should I?
>
> Thanks, I can give it a try.

Here's a patch where the static variables are now proper fields in the
ns_output structure.  Is that what you had in mind?


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-memory-leak-in-ns_draw_relief.patch

From ebcf7ca3e8a2add11050be4c1d7e991e3c0f0a6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@HIDDEN>
Date: Sun, 10 Jul 2022 22:36:28 +0200
Subject: [PATCH] Fix memory leak in ns_draw_relief

* src/nsterm.h (struct ns_output): New fields to store the relief
colors.
* src/nsterm.m (ns_setup_relief_colors): New function to keep the
relief colors as part of the ns_output structure.
(ns_draw_relief): Remove static local variables.  Assigning them to
nil caused a memory leak of NSColor instances (bug#56462).  Call
ns_setup_relief_colors instead.
---
 src/nsterm.h |  6 +++++
 src/nsterm.m | 68 +++++++++++++++++++++++++++-------------------------
 2 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/src/nsterm.h b/src/nsterm.h
index 7a097b3248..2a4c7571a3 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -927,6 +927,9 @@ #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
   NSColor *cursor_color;
   NSColor *foreground_color;
   NSColor *background_color;
+  NSColor *relief_background_color;
+  NSColor *light_relief_color;
+  NSColor *dark_relief_color;
   EmacsToolbar *toolbar;
 #else
   void *view;
@@ -934,6 +937,9 @@ #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
   void *cursor_color;
   void *foreground_color;
   void *background_color;
+  void *relief_background_color;
+  void *light_relief_color;
+  void *dark_relief_color;
   void *toolbar;
 #endif
 
diff --git a/src/nsterm.m b/src/nsterm.m
index 7f232e7292..8e0c4b84f0 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3475,6 +3475,35 @@ larger if there are taller display elements (e.g., characters
     }
 }
 
+/* Set up colors for the relief lines around glyph string S.  */
+
+static void
+ns_setup_relief_colors (struct glyph_string *s)
+{
+  struct ns_output *di = FRAME_OUTPUT_DATA (s->f);
+  NSColor *color;
+
+  if (s->face->use_box_color_for_shadows_p)
+    color = [NSColor colorWithUnsignedLong: s->face->box_color];
+  else
+    color = [NSColor colorWithUnsignedLong: s->face->background];
+
+  if (s->hl == DRAW_CURSOR)
+    color = FRAME_CURSOR_COLOR (s->f);
+
+  if (color == nil)
+    color = [NSColor grayColor];
+
+  if (color != di->relief_background_color)
+    {
+      [di->relief_background_color release];
+      di->relief_background_color = [color retain];
+      [di->light_relief_color release];
+      di->light_relief_color = [[color highlightWithLevel: 0.4] retain];
+      [di->dark_relief_color release];
+      di->dark_relief_color = [[color shadowWithLevel: 0.4] retain];
+    }
+}
 
 static void
 ns_draw_relief (NSRect outer, int hthickness, int vthickness, char raised_p,
@@ -3486,40 +3515,13 @@ larger if there are taller display elements (e.g., characters
     of some sides not being drawn, and because the rect will be filled.
    -------------------------------------------------------------------------- */
 {
-  static NSColor *baseCol, *lightCol, *darkCol;
-  NSColor *newBaseCol;
   NSRect inner;
-  NSBezierPath *p;
-
-  baseCol = nil;
-  lightCol = nil;
-  newBaseCol = nil;
-  p = nil;
+  NSBezierPath *p = nil;
 
   NSTRACE ("ns_draw_relief");
 
   /* set up colors */
-
-  if (s->face->use_box_color_for_shadows_p)
-    newBaseCol = [NSColor colorWithUnsignedLong: s->face->box_color];
-  else
-    newBaseCol = [NSColor colorWithUnsignedLong: s->face->background];
-
-  if (s->hl == DRAW_CURSOR)
-    newBaseCol = FRAME_CURSOR_COLOR (s->f);
-
-  if (newBaseCol == nil)
-    newBaseCol = [NSColor grayColor];
-
-  if (newBaseCol != baseCol)  /* TODO: better check */
-    {
-      [baseCol release];
-      baseCol = [newBaseCol retain];
-      [lightCol release];
-      lightCol = [[baseCol highlightWithLevel: 0.4] retain];
-      [darkCol release];
-      darkCol = [[baseCol shadowWithLevel: 0.4] retain];
-    }
+  ns_setup_relief_colors (s);
 
   /* Calculate the inner rectangle.  */
   inner = outer;
@@ -3542,7 +3544,9 @@ larger if there are taller display elements (e.g., characters
   if (bottom_p)
     inner.size.height -= hthickness;
 
-  [(raised_p ? lightCol : darkCol) set];
+  struct ns_output *di = FRAME_OUTPUT_DATA (s->f);
+
+  [(raised_p ? di->light_relief_color : di->dark_relief_color) set];
 
   if (top_p || left_p)
     {
@@ -3564,7 +3568,7 @@ larger if there are taller display elements (e.g., characters
       [p fill];
     }
 
-  [(raised_p ? darkCol : lightCol) set];
+  [(raised_p ? di->dark_relief_color : di->light_relief_color) set];
 
   if (bottom_p || right_p)
     {
@@ -3626,7 +3630,7 @@ larger if there are taller display elements (e.g., characters
 				   NSMaxY (outer) - 0.5)];
     }
 
-  [darkCol set];
+  [di->dark_relief_color set];
   [p stroke];
 
   if (vthickness > 1 && hthickness > 1)
-- 
2.34.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 10 Jul 2022 10:37:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 10 06:37:57 2022
Received: from localhost ([127.0.0.1]:36286 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAUK5-0005fO-04
	for submit <at> debbugs.gnu.org; Sun, 10 Jul 2022 06:37:57 -0400
Received: from sonic310-57.consmr.mail.ir2.yahoo.com ([77.238.177.30]:40108)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1oAUK3-0005fB-Qg
 for 56462 <at> debbugs.gnu.org; Sun, 10 Jul 2022 06:37:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1657449470; bh=OADT1D2xOaRBGHZ43UiFGSTI4aJOJmvZB5IcdWPY+qQ=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=gH4Ll3D9w3JvgKFWttJh1WCUoBoJK0eyy5bgTMhktNdmRrseEVj8wrndRx/86OixNxx9pRwvIwm2g8ea/YCYJvJnHKnfeXI/swZjZLztPspUlbWGvXAbImDLt2oQuitKvdHQu+0e5PsrG0VudfG6ZvX4dzFsYG+YAezYtFRp4ybhyZj6iw8V16yJSHvt2onI3p7wl09/FWD+a2LH8WtAFopDchpb4U1r6SvDRf7ozyORKINWiUfF5pKmLambBY4IM4h44zaPf8O52zwcktqmxJLm1CDWwhpwbGOBGaapYd2gn9zdHo2eDUY+rW0ZNICFEPpliNR97iTbS843xadUew==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657449470; bh=E8POWTufu1fm/y69VReUxH+taaTbIDSlMxd3Ryme/sX=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=dnpbO5sDbD7kGsww0uX42MpUfUiZtOe51jQCN8O7eeWuLu2Y+nK4UP/wYkPzhDGdac4rawLVm2+WKISvZR5mftqsAojtEe2xsg5p36/BUzPJs9DHFIEncG+vl6DmU48C7s6715KwHmTDTUX0XP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QmtGu4PfBTdwj.k0uO7ICOgq6t5Q3_jOTtEoZ22HCbvcPqjmlRTVgVbQg_Rnofib3372l
 najlQDZHZgY4doF4cELJG4F_egq2.dw_0t4r0yg6owzxjxFzpspum0c2Ar52NidzZOVMMzxVZGBq
 vKb2JGrS1L5RSW8VComYZht13.fDEJgJJOOmWIh8niCX1.KfmYcaQ9Yg2Vw77RTtwBf.A3mpOA.b
 aOJdw.RlK6d2ubR51dBOTP8J2YPHy4BCGQeuIuaaKFF26CY_.zSWCMsYqLsbcxaAUbdjZPSWxAMU
 u53OfrlO_39fOISOrgisS_r1_1Wbuw5_aPcNF.W.jewtQBSDHVF5wVqW_HIW2H3J.wuWekokAMnZ
 B_z9n7zo8tTPxUHRxRKDE0JlwKCsm45m.HFAbj3bUba4ulsLSu9io8XLueGip5g--
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sun, 10 Jul 2022 10:37:50 +0000
Received: by hermes--canary-production-ir2-74b4d6d794-wvl67 (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 73c95a8de31e559cff528b513f57479c; 
 Sun, 10 Jul 2022 10:37:49 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: Po Lu <luangruo@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
 <87tu7p1z75.fsf@HIDDEN>
Date: Sun, 10 Jul 2022 12:37:48 +0200
In-Reply-To: <87tu7p1z75.fsf@HIDDEN> (Po Lu's message of "Sun, 10 Jul 2022
 10:25:18 +0800")
Message-ID: <m1k08lxngj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 1071
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 56462
Cc: 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Po Lu <luangruo@HIDDEN> writes:

> Daniel Mart=C3=ADn <mardani29@HIDDEN> writes:
>
>> I ran the Leaks tool with Emacs 29, and I've found a memory leak in the
>> NS version of Emacs.
>>
>> Since commit c7b48b61d08f0b6a08584080badc60fe62ba1db1, in function
>> ns_draw_relief, static local variables baseCol and lightCol are assigned
>> to nil separately to their declaration.  That has the subtle consequence
>> that the further down calls to [baseCol release] and [lightCol release]
>> become a no-op, so each time ns_draw_relief is called it leaks some
>> instances of NSColor.
>>
>> The fix is to revert to the previous way those static variables were
>> declared.
>>
>> I've attached a patch with the correction.  With this fix, the leaks
>> tool doesn't report the NSColor leaks anymore when I play around with
>> Emacs 29.
>
> Thanks.  But I think the use of static variables there is rather ugly,
> and it would be much nicer if we replicated the `x_setup_relief_color'
> logic there.
>
> Do you want to work on that, or should I?

Thanks, I can give it a try.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at 56462 <at> debbugs.gnu.org:


Received: (at 56462) by debbugs.gnu.org; 10 Jul 2022 02:25:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 09 22:25:36 2022
Received: from localhost ([127.0.0.1]:36092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oAMdc-0006yj-62
	for submit <at> debbugs.gnu.org; Sat, 09 Jul 2022 22:25:36 -0400
Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]:42424)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <luangruo@HIDDEN>) id 1oAMda-0006yT-0p
 for 56462 <at> debbugs.gnu.org; Sat, 09 Jul 2022 22:25:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657419927; bh=kAReL0zYcqLi1JmWs2S59Cm9HTXsNCeoCFgg1/dmog0=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To;
 b=kOYLybu5eRPEEvQWGJOp3pzQqkiHBI4nLvrJMNLACU8BN4lGxumPRiKKHljl0sQ8nWOEdI171UJcuH6etVxOBdW/tuRrLp6230lpszwZkbwy+YZMwkAfVIoG2laLJ735SZQFWnohnKxaSFgZnbaDQNLMBwzbg4NUI02RrOwhSdbSToXT0EUSpMbzTXg1LTmurxoKGOqfSzeOTnTVGKxIUdeeyJiu7YIiF9mZGNF0OjhWL5UMvrgJ+IuLXAgzPFCUzhDqByGd5hLsODXTTEDEMVZgISbZm13n6l9WxwAOChnRPg0zM5r+uEoXCU9ARNoBkI9sWE32Bc+Nzfne/dBCtQ==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657419927; bh=5OiWMSru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NWAzlmQ2IlDjipQKGOsdZu6SJleyfHFMSqQ7nG
 2LDZL4qfzRp9Jw3.85b5LVoPYwkk16.leci4noYAM3C0n0EU.rgqdg0z77U5JNo5VQ_pX2sXX2f0
 OV_cho4W8otC6dqdrOofHg50XV0RcWj2KDPWeIktk4dgH7WXPPW86hdirPE.pJZ7QY2Q91cp2MHt
 D8pH884g6AcNbL2IRWuIL65JfN1PiSKImcKtLfPrisgZtWKhfDgPBisspUjAUDaXCcRgaJ8f688u
 jvwjUSjmzcoSBlBgPghytofG3s85GCqxTstrrHP4C6QOWc.jYIvSJCzBIdTZvPhspV7_fF5J8EQs
 bThohnCnkQxeMyRt_UeIlpOl1XkdzHPy2hyQzHv8cew4aTJO4DGmHFC3XYDMSapzWc3.Sq6XgUl5
 oTQi_UG_zZBstf7cECDY6yXdyZdY7g8i0A8lnlOiNWrb0G0IwxWHytio..a2Va4RBYM559A0Gjes
 tqMeVebZuJMwjSQRFK2oW6o51e7lnpb9llQ0FtEh0Zrew3qMau2cyOZul0KWHjSvCIpef0oQDR1F
 4uInKLIJC4Kjnj8Zclc_TeogWyJ7s5igjwOSFKoUmwDioJt4hi_.MqOhL5cOmuqdv
X-Sonic-MF: <luangruo@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic313.consmr.mail.ne1.yahoo.com with HTTP; Sun, 10 Jul 2022 02:25:27 +0000
Received: by hermes--canary-production-sg3-67975bbd4b-hh5lh (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID c964110a468857ee6d87810df6aecd97; 
 Sun, 10 Jul 2022 02:25:22 +0000 (UTC)
From: Po Lu <luangruo@HIDDEN>
To: Daniel =?utf-8?Q?Mart=C3=ADn?= <mardani29@HIDDEN>
Subject: Re: bug#56462: 29.0.50; [PATCH] Memory leak in ns_draw_relief
References: <m1fsjaz84s.fsf.ref@HIDDEN> <m1fsjaz84s.fsf@HIDDEN>
Date: Sun, 10 Jul 2022 10:25:18 +0800
In-Reply-To: <m1fsjaz84s.fsf@HIDDEN> ("Daniel =?utf-8?Q?Mart=C3=ADn=22's?=
 message of "Sat, 09 Jul 2022 16:13:39 +0200")
Message-ID: <87tu7p1z75.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 976
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 56462
Cc: 56462 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Daniel Mart=C3=ADn <mardani29@HIDDEN> writes:

> I ran the Leaks tool with Emacs 29, and I've found a memory leak in the
> NS version of Emacs.
>
> Since commit c7b48b61d08f0b6a08584080badc60fe62ba1db1, in function
> ns_draw_relief, static local variables baseCol and lightCol are assigned
> to nil separately to their declaration.  That has the subtle consequence
> that the further down calls to [baseCol release] and [lightCol release]
> become a no-op, so each time ns_draw_relief is called it leaks some
> instances of NSColor.
>
> The fix is to revert to the previous way those static variables were
> declared.
>
> I've attached a patch with the correction.  With this fix, the leaks
> tool doesn't report the NSColor leaks anymore when I play around with
> Emacs 29.

Thanks.  But I think the use of static variables there is rather ugly,
and it would be much nicer if we replicated the `x_setup_relief_color'
logic there.

Do you want to work on that, or should I?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jul 2022 14:13:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 09 10:13:50 2022
Received: from localhost ([127.0.0.1]:35671 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oABDR-0000us-P6
	for submit <at> debbugs.gnu.org; Sat, 09 Jul 2022 10:13:50 -0400
Received: from lists.gnu.org ([209.51.188.17]:48158)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1oABDQ-0000uj-2a
 for submit <at> debbugs.gnu.org; Sat, 09 Jul 2022 10:13:48 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54754)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oABDP-0007oz-U0
 for bug-gnu-emacs@HIDDEN; Sat, 09 Jul 2022 10:13:47 -0400
Received: from sonic305-20.consmr.mail.ir2.yahoo.com ([77.238.177.82]:44518)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1oABDO-00087I-3M
 for bug-gnu-emacs@HIDDEN; Sat, 09 Jul 2022 10:13:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1657376022; bh=f1fPTntxucv/FD9HBM/VbX/fJ1KHUuMijQlILsqFj4c=;
 h=From:To:Subject:Date:References:From:Subject:Reply-To;
 b=LrbBKEfm+0AigJfjHH3GKb+xn9fvhVRodDh3dJwCWPiYDq7uNM07lzZqf1IzqpOgt0qG60QmKAnQ0wm/lFASau4Qm/8+47Sn49y7cw8dM5e4udx9UIMDETQnKpLL6kXuQSZjXXT0lM9laA7YQj+kxec4OkWtDuTq5AuaifG8Ip5pLe2nyDqoLYyQ1Rwx5L38DRTNt6uD8ENHocO4iRox+bOb/VrQDbMoStB392cyokSjpGXdCrqXo53jTGIQJ1qOfrB6L31dvyTp8t4wWtvKuvwgw4PcFbnmjInGtOdZJj4MFtAih3oMNJuxq56s/UFaPhKMNdwIH3rOWh9yBYLPvw==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1657376022; bh=h2HAOPEC2SnJIJW/AXKpxPVy/QA9p2mZPuM4j9dcz0v=;
 h=X-Sonic-MF:From:To:Subject:Date:From:Subject;
 b=C++24Tkk1818noPpHkLltswKAocftuHn5kMhulk/bxsTz8kDpW0uxIRYg6RAsRDTgJKHXO197zekcXnESi0X2/ofUXuKsLOzjew86Mcb7ix4DPxAjzR3dgN3JBlLCPxHe6IQBTF6J1g6Ju7hVIJvQfW6Ab2vQ1eGMi7L+zgeGl2b6k7zxMh4NWLM2S1/bwQ+n/YU+kD+7li38lxEbhCk3CEP4FzlQoLs8QOfIEF3LshD1oXNP0KxTDfwQUtoRk5HGx3gDVjYYg7HNbEZr7pajIjdBFb3PD22yX1E5d+B183NCjEWn3IflsiVTex+UnXgIMLIP6sSGSjj3yXeGCSbIA==
X-YMail-OSG: e9wEWNcVM1m_sErNAYwpaKUg5KgNGtT.A1lSmvDzFA.I1jqDu2f7feXBtUifYFW
 HYTeSHljZ4KOzKUhpK08EdzoExeMKGKa9M0vnpmrrDOCaD9jpKLj8cA9Qnpw7PXdQKAvfsde2B3A
 V8xuzQHIBVffQbjKPDy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HuWa
 hCJQVoxD4BJL826nunyUNjtzrAnUILNQzlMRn
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic305.consmr.mail.ir2.yahoo.com with HTTP; Sat, 9 Jul 2022 14:13:42 +0000
Received: by hermes--canary-production-ir2-74b4d6d794-lc6zr (Yahoo Inc. Hermes
 SMTP Server) with ESMTPA ID 23047981090dd0634074fd1ae552ba00; 
 Sat, 09 Jul 2022 14:13:40 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; [PATCH] Memory leak in ns_draw_relief
Date: Sat, 09 Jul 2022 16:13:39 +0200
Message-ID: <m1fsjaz84s.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
References: <m1fsjaz84s.fsf.ref@HIDDEN>
X-Mailer: WebService/1.1.20381
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 2131
Received-SPF: pass client-ip=77.238.177.82; envelope-from=mardani29@HIDDEN;
 helo=sonic305-20.consmr.mail.ir2.yahoo.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain


I ran the Leaks tool with Emacs 29, and I've found a memory leak in the
NS version of Emacs.

Since commit c7b48b61d08f0b6a08584080badc60fe62ba1db1, in function
ns_draw_relief, static local variables baseCol and lightCol are assigned
to nil separately to their declaration.  That has the subtle consequence
that the further down calls to [baseCol release] and [lightCol release]
become a no-op, so each time ns_draw_relief is called it leaks some
instances of NSColor.

The fix is to revert to the previous way those static variables were
declared.

I've attached a patch with the correction.  With this fix, the leaks
tool doesn't report the NSColor leaks anymore when I play around with
Emacs 29.

Thanks.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-memory-leak-in-ns_draw_relief.patch

From acebb668e310da526f262f6a47090eddbb9c76a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@HIDDEN>
Date: Sat, 9 Jul 2022 15:54:07 +0200
Subject: [PATCH] Fix memory leak in ns_draw_relief

* src/nsterm.m (ns_draw_relief): Assigning the static local variables
baseCol and lightCol to nil leaks memory as of the second time
ns_draw_relief is called, because the calls to [baseCol release] and
[lightCol release] further down the function become a no-op.

This bug was introduced in c7b48b61d08f0b6a08584080badc60fe62ba1db1.
---
 src/nsterm.m | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 7f232e7292..dc55edf0eb 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3486,13 +3486,11 @@ larger if there are taller display elements (e.g., characters
     of some sides not being drawn, and because the rect will be filled.
    -------------------------------------------------------------------------- */
 {
-  static NSColor *baseCol, *lightCol, *darkCol;
+  static NSColor *baseCol = nil, *lightCol = nil, *darkCol = nil;
   NSColor *newBaseCol;
   NSRect inner;
   NSBezierPath *p;
 
-  baseCol = nil;
-  lightCol = nil;
   newBaseCol = nil;
   p = nil;
 
-- 
2.34.1


--=-=-=--




Acknowledgement sent to Daniel Martín <mardani29@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#56462; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 11 Jul 2022 10:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.