From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: shr using `make-xwidget' incorrectly Date: Thu, 11 Nov 2021 15:05:19 +0800 Message-ID: <87fss3xjdc.fsf@yahoo.com> References: <87sfw31mok.fsf.ref@yahoo.com> <87sfw31mok.fsf@yahoo.com> <831r3n2n6j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4998"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: larsi@gnus.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 11 08:06:53 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ml4Af-00014H-HD for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Nov 2021 08:06:53 +0100 Original-Received: from localhost ([::1]:37418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ml4Ae-0002rO-Cm for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Nov 2021 02:06:52 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ml49M-00025Z-F4 for emacs-devel@gnu.org; Thu, 11 Nov 2021 02:05:32 -0500 Original-Received: from sonic309-22.consmr.mail.ne1.yahoo.com ([66.163.184.148]:39602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ml49K-0003Xr-Pn for emacs-devel@gnu.org; Thu, 11 Nov 2021 02:05:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1636614328; bh=OGeuGGrcDlbeFlqbP643R0/IDzXJOjirBlpmGAPuB7I=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=oNRpzt1Od5w5VBvK2l1Twjoj+YPe1JNBXbmlPbXE8GbQZsTfNE1n2FjURePYRc6hIOC611eFiF4tZXnbTE2bjB6V8Ns12tLAIFBZvIc3XoXHRxpqOJ1N/5D5uA9NCZX38vCqy2777z9aWcBGy3M1obUUAtIhDY/1kyA5VSrKlEWoD2iBG89R0zb5hky8wuLXdHlJZ4YyVQsD7tru0q7GEasSSxmxnGT2VigIAZbuRudpooCGvYBDD408Ol6veIA2s+8xSU39Te/PuDevVwFaPPYBertZC3hzk11zKew4pGVjH7vx7NZ2elsIfNoTE+PMvg98s87JWk7yYrmec+J9qQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1636614328; bh=Qywj4Jr7V7PQpP8t936Yx72MQY/O1/XR6XDZpTRbHmf=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=ZBI5k5V5IQETPqJf+U221MKI8pXsf30OnydpZUIzxzpTt986peSXi2stBkntv5L0XBayCTLxQk8mp9EwMycDGFD7Zd2JQI2zpRf+oSkJ+oPYhyXfASgJM5J+eKWkSthcLvp2zjstRYmJ1CrLgIrsApYc8nf8vr2FyZiVGEABAok/BvO1aQVO9Bq4qiKtSQdIbeEIx/eI52XeYPURuXbH+Q+dUj9xAaFkQ9MQgGNTV6IuqNPqGHHcwjcAmka386fPkX/W772iGDv6uOnheUqLJeWoyS9Vo0Ff/lXY4H4KJIRhz2hPpcdxrZ7NKB+JLYYAbWmXialfQIaHpCHmBmi+uQ== X-YMail-OSG: 3vMKyL4VM1lYJ8demKv0z7XaWKPm.G1gTu3P0eNkLTqcWh7B3kqROdc6I3cnIfF 4d24hOrXJg0X0jEqiI4KvJ5lfSI3rBFMMXP7uRJsAlbQAutuT5_z1UUdQQpbt8tqsUmACIDF3R_l dt1BE5Azp8ZhEeH2me0utRDjCrSxnxzMrMKJkv386MO0rxkiRKtHNTHySEL7Din_JaQZfgPRRSkO yAb0aegFZRreQ50Q_Ns1Pt9iPgxH8dC6bBdLyqawi2gWRYRM5ZYuNWNHp3VRMEFm7rKoPGHXDo.B wBVGt_RbQvpeBys4bxlhHmONNxEj3UsqNvNiOlhBMpc38_TiJ2JvZx.YkRdfluBF8BM_ZM3UGIXJ atvu81mUyajIv15oPD6j6qxAVy_qBpkhkVfuIGOnFkDR.4jAGRV5RtTetJCQE8ws91FpjBcBaJeQ nYcszDJwHsVQVqZObgu_u6uK8keQpU8C0YtKy74b18qIjczo_BElKP7ebZf_6Cv2BL3WG0cGsOYN NKMBv28TQhjRM04WpQqrUBIQTQMHV3Sb4QfbzDpyfVPacdosShcZtOJX6N3hxSnoofCLCzN2HZJ. 6ihvKhdcwlUkllXoxOtQ9AnLozX3qcJqM9a3mTk86R4krVHtiU08sb2BsrWb2sZ37br4NGCgWph4 AKGzX.ZzKamYAzIJkr8xeXAlBq7S8viUsZRwDJ9pS_ucxLAJJ_k04rpZBrE9krE2A91rz.4SvUh3 Gr2FE_KiNzEHsZkPi1G02qd44bW5MJJu6TnZueiMyURh1jvrD6cpT2BP2SGZZ7W_pchwRj8_ACwa ETrUcrQH38MBHrpzh8ZwjHidCRLJvHh6AwAeeeeAGm X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Thu, 11 Nov 2021 07:05:28 +0000 Original-Received: by kubenode503.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1b0bc78327d0bc836eae233858047ba8; Thu, 11 Nov 2021 07:05:23 +0000 (UTC) In-Reply-To: <831r3n2n6j.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 11 Nov 2021 08:58:44 +0200") X-Mailer: WebService/1.1.19306 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.184.148; envelope-from=luangruo@yahoo.com; helo=sonic309-22.consmr.mail.ne1.yahoo.com 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279229 Archived-At: Eli Zaretskii writes: >> Which reminds me of another problem (in the Emacs 28 xwidget code as >> well): If an xwidget's buffer is killed, but references to it still >> exist somewhere, crashes can happen, because the GTK resources allocated >> to the xwidget are killed in `kill_buffer_xwidgets' and not during >> garbage collection. >> >> I think the best thing to do in this case would be to introduce a >> `dead' state for xwidgets, not unlike killed buffers and dead frames, >> which an xwidget is set to after being killed. >> >> Then, performing any sort of operation on a killed xwidget can either >> throw an error, or do nothing. > Why can't we release the GTK resources when such a buffer is killed? We are releasing the GTK resources when such a buffer is killed. This is the problem here: code that uses `CHECK_XWIDGET' won't catch the case where the GTK resources are released, but there are still references to the xwidget, which causes use-after-frees when trying to redisplay the xwidget, or when calling, say, `xwidget-webkit-goto-uri' on the xwidget. The comment in kill_buffer_xwidgets that says: /* TODO free the GTK things in xw. */ Is probably outdated and likely should be removed. But I am still investigating through the history of that file to make sure of that, so please bear with me for a while. Thanks.