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: shr using `make-xwidget' incorrectly Date: Thu, 11 Nov 2021 09:54:51 +0800 Message-ID: <87sfw31mok.fsf@yahoo.com> References: <87sfw31mok.fsf.ref@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4284"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 11 03:06:14 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 1mkzTi-0000ym-EK for ged-emacs-devel@m.gmane-mx.org; Thu, 11 Nov 2021 03:06:14 +0100 Original-Received: from localhost ([::1]:45134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkzTh-0006PL-HG for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Nov 2021 21:06:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkzIu-0005i9-9G for emacs-devel@gnu.org; Wed, 10 Nov 2021 20:55:05 -0500 Original-Received: from sonic310-25.consmr.mail.ne1.yahoo.com ([66.163.186.206]:43015) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkzIr-00044U-OS for emacs-devel@gnu.org; Wed, 10 Nov 2021 20:55:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1636595700; bh=8XM0zxjAfI0qU22x4BcdqtHnyoTCL1BVtIJaTaekGpI=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=J+ptYv8UBBTagM1eT38ijTahegLXmP8GoL6ShrvIPjdpNT1cI1LTQJXiuecbTkAGzS0bM0k6+QBlwaO5iwLoKUm8okTNlD5fRG8tsbJOAO+e6oFjqa9y3SEBTRe9pRLYt3XuVuYKc1hTkiP9PCh792QToP4woYpxnW9jNRMOU2ytRmvAn2mb+7VAXJG4QjDnsLgJIWlK9yXyFQBVTf1W314mvIH32TpJPIEvHJeYlTL7ljoRFVZ8/k9uyysAGjdsrBtgSyaVZ2mdHukiOTzwNuYoS1OYogWO60oHfELS5HFNFFNbQu4UKly4H4GQJ3jrA0yufq9FZR2k/uxpLExj3A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1636595700; bh=w/ZXcZ/KpJB8h9YE0ctiAGudzVD8c63kWxaENC13Zjr=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=PIjGQreiWkO/5C50AXJrHe3aML7tDnFtrK/1IzSFrVkvW19ZJCzmKxCPX6rH78i0y2cS/+rUH1/EgTQcqL9uVtACl/XGSZVm0tB44cIArhdDETNJdoXvTwrlpL9kp0IW18+HHRqoO3zpmikVr4/QFp1u7Qlc58EIE7g5vNyq324K12iUV0GsrIU3Bh/Gm3LNB8+V2CJ/JDlYQ9Xq5AGIOlW0lWVu9UWJyiCEmgMJv/DnWaFvEDpYmczaB3dd36yPUFLSbJLrfx246yvirQSvIMUW0v98rMU6FLg0Jvpt+UwGNbaSqKE9ye9zHjxqFEpxtNyNi2Lh6QbihpV4w8hDBw== X-YMail-OSG: wDYB8UIVM1l2U9EiCb9_vjBzs8LW74jAp4W7I8G1Rz6Eovdp7ezhFzqV7.WrYZg ScsL4NW_E_SJ96eDlw2p7VLxCmWo7dS8d2spsIHEjQklggJerQl3HXEK.y1Fmd3CjUEcV3hcoH0H b4JF2Tl5koZ2Jiht3mNqN40O8H1lduWJDZqWXipxEK53Ogj7RxtpEtp.6xyQuQCS6A9wC0AxfaBR Iv8Hh4QDJVJzPqN6lUoZlA6lpHWNn9AbLu9jrXkrwVEsbvsafILoqtQVq3TWziK3yDCEEonZ8kb5 QpK4nvI6zFvgB5AWDLUGofoW.thG3j.wm5mCakhu3uWZkjuO1UTd.B31qAJETl1gGYRd5RoFwerS .mtUAZ1wvAhulgEjhpqsJzDUPKgHtklo44W8V7yBspaCoH2CqOYlklcXaGCk605g1rDQYdasl2J2 0JTDp9XyI3Q4twYMIiSxCwsYR2CUQ7zN2AqzStqltzfJbUlhlaClYgzQy_TguMMidkotCavGFoWM C3GhgMZfW1gRPzg9zjvfrcjcImz.e8E_ptutTH3y3OAlCQJdrwR5w5nNiXNyH0W_SS.iK.tTDZXz cyzLdEm4xkl.o52KAZe4d3uIxcORFNUptNk0a37w_sJ66Uq.LzHDKngdhyjK1zZ3Gy4P6juRE9P7 cUsQwEPng6XBy0k2Bqx3Q1WQkgnBOY2i5xJ_pZINIbxzbAx65q9oNVt0frPc5z6hVvq_AtFC8jxi 1Szkqphb9Y1y0pL9yCIoKhgsny2qJkHTJD7WzUloehc2acs_MuEclTOYCsIB9Rqq7FvfBcGuss2S Wcio5YafRr.6LAik.TWb.ELf.y2qilcBTPpmVRCX_c X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Thu, 11 Nov 2021 01:55:00 +0000 Original-Received: by kubenode515.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fceebf5ed3d390833e7558767adc9a12; Thu, 11 Nov 2021 01:54:54 +0000 (UTC) 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.186.206; envelope-from=luangruo@yahoo.com; helo=sonic310-25.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:279208 Archived-At: Lars, you might want to know that `make-xwidget', invoked without a buffer argument, will create an xwidget attached to the current buffer. That xwidget won't be killed until you kill the buffer it's attached to. So you should either try to re-use existing xwidgets (see `get-buffer-xwidgets'), or to kill the buffer the xwidget is attached to. Otherwise, every re-render will cause more xwidgets to be created, leading to undesirable resource consumption (WebKit widgets are heavy!). 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. But I'd like the others to chime in as well. Thanks.