From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.devel Subject: Re: long-standing GTK bug Date: Thu, 03 Mar 2022 12:25:42 +0530 Message-ID: References: <83zhbcg6s4.fsf@gnu.org> <87r1wng2ki.fsf@linaro.org> <83o8rrenn1.fsf@gnu.org> <87blnr6uck.fsf@tullinup.koldfront.dk> <87wo5kumkn.fsf_-_@tullinup.koldfront.dk> <86ftc5hc8j.fsf@gmail.com> <87d079io10.fsf@tullinup.koldfront.dk> <87ftbyokll.fsf@tullinup.koldfront.dk> <87pmn5cqpk.fsf@tullinup.koldfront.dk> <871qzktpd8.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2633"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Cancel-Lock: sha1:RGrpeyu5/ZnIo0dqJ+raIklrf9E= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 03 07:57:15 2022 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 1nPfOl-0000Ub-8O for ged-emacs-devel@m.gmane-mx.org; Thu, 03 Mar 2022 07:57:15 +0100 Original-Received: from localhost ([::1]:58872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPfOj-0006FV-Ur for ged-emacs-devel@m.gmane-mx.org; Thu, 03 Mar 2022 01:57:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPfNb-0005UJ-OV for emacs-devel@gnu.org; Thu, 03 Mar 2022 01:56:03 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:57906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPfNW-0006EE-A9 for emacs-devel@gnu.org; Thu, 03 Mar 2022 01:55:59 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nPfNT-0009Pw-76 for emacs-devel@gnu.org; Thu, 03 Mar 2022 07:55:55 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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:286777 Archived-At: * Po Lu <871qzktpd8.fsf @yahoo.com> : Wrote on Wed, 02 Mar 2022 22:12:35 +0800: > Adam Sjøgren writes: > >> A recent blog post: >> https://tychoish.com/post/the-emacs-daemon-gtk-bug-a-parable/ made >> me aware of the continued discussion that happened on the GTK issue >> 11 months ago, which I had previously missed. >> A very interesting comment is this one by Michel Dänzer: >> FWIW, the upcoming release 40 of mutter (which uses GTK3 for drawing >> X11 client window decorations) is able to survive Xwayland dying >> abruptly, using the new XSetIOErrorExitHandler API (which removes >> the need for longjmp hacks) available as of libX11 1.7.0. >> · https://gitlab.gnome.org/GNOME/gtk/-/issues/2315#note_1052481 >> Which sounds like exactly what is needed, doesn't it? >> Switch from using the current XIOErrorHandler to the "new" >> XSetIOErrorExitHandler API to avoid the longjmp and the sketchy >> patchy hackery I ended up with. >> This API is available in libX11 1.7.0 - I just checked the version >> in Debian stable, and it is 1.7.2, so it's not some outrageously new >> bleeding edge addition. >> Now we just need someone with libX11 API chops to start ... eh, >> chopping! > > It doesn't work. The part of Mutter that inherited from Metacity is > special in how it uses GTK for various reasons, so it works for them. > > The call to longjmp is not the problem. Rather, it was the original > workaround. Removing the longjmp will just make GTK call _exit upon > an IO error, which we cannot avoid. (See for example the > `_gdk_x11_display_error_event' function in the GTK source code.) I tried to do a proof of concept using XSetIOErrorExitHandler to prove it was possible to kill the display and still have a gtk app running. https://gitlab.gnome.org/enometh/simple4/-/raw/master/simple.c which seemed to work. the code is a bit crufty as it includes the longjmp path , and i have to reread it to understand it and my headaches are interfering with thinking. When i checked there was some other snag in moving this to emacs