]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent subprocess hangs in xwidget
authorPo Lu <luangruo@yahoo.com>
Wed, 17 Nov 2021 13:30:20 +0000 (21:30 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 17 Nov 2021 13:32:52 +0000 (21:32 +0800)
* src/xwidget.c (Fmake_xwidget, Fxwidget_webkit_goto_url): Use
`catch_child_signal' instead of trying to preserve the previous
signal handler.

src/xwidget.c

index e1d54d43b74c1109044049ef7923275c939d04b5..e1bf40ea437ed971fc4de9df94959c82eccc1f6f 100644 (file)
@@ -32,6 +32,7 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #include "sysstdio.h"
 #include "termhooks.h"
 #include "window.h"
+#include "process.h"
 
 /* Include xwidget bottom end headers.  */
 #ifdef USE_GTK
@@ -189,14 +190,12 @@ fails.  */)
            {
              xw->widget_osr = webkit_web_view_new ();
 
+             webkit_web_view_load_uri (WEBKIT_WEB_VIEW (xw->widget_osr),
+                                       "about:blank");
              /* webkitgtk uses GSubprocess which sets sigaction causing
                 Emacs to not catch SIGCHLD with its usual handle setup in
                 'catch_child_signal'.  This resets the SIGCHLD sigaction.  */
-             struct sigaction old_action;
-             sigaction (SIGCHLD, NULL, &old_action);
-             webkit_web_view_load_uri (WEBKIT_WEB_VIEW (xw->widget_osr),
-                                       "about:blank");
-             sigaction (SIGCHLD, &old_action, NULL);
+             catch_child_signal ();
            }
          else
            {
@@ -1841,6 +1840,7 @@ DEFUN ("xwidget-webkit-goto-uri",
   uri = ENCODE_FILE (uri);
 #ifdef USE_GTK
   webkit_web_view_load_uri (WEBKIT_WEB_VIEW (xw->widget_osr), SSDATA (uri));
+  catch_child_signal ();
 #elif defined NS_IMPL_COCOA
   nsxwidget_webkit_goto_uri (xw, SSDATA (uri));
 #endif