summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2018-03-16 12:44:04 +0100
committerQuentin Rameau <quinq@fifth.space>2018-10-08 11:38:03 +0200
commitc60523a702fbc77899457243f1a85e4990adfb97 (patch)
tree7da436f5f367fd249d5ea7787542d367adef0f3a
parentbefe481a9b970cf2bc90ca671e1df1d1082ac41e (diff)
downloadsurf-c60523a702fbc77899457243f1a85e4990adfb97.tar.gz
surf-c60523a702fbc77899457243f1a85e4990adfb97.tar.bz2
surf-c60523a702fbc77899457243f1a85e4990adfb97.zip
Exit more gracefully on web process crash.
-rw-r--r--surf.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/surf.c b/surf.c
index ae2bc81..eab314a 100644
--- a/surf.c
+++ b/surf.c
@@ -206,6 +206,9 @@ static void downloadstarted(WebKitWebContext *wc, WebKitDownload *d,
Client *c);
static void responsereceived(WebKitDownload *d, GParamSpec *ps, Client *c);
static void download(Client *c, WebKitURIResponse *r);
+static void webprocessterminated(WebKitWebView *v,
+ WebKitWebProcessTerminationReason r,
+ Client *c);
static void closeview(WebKitWebView *v, Client *c);
static void destroywin(GtkWidget* w, Client *c);
@@ -1187,6 +1190,8 @@ newview(Client *c, WebKitWebView *rv)
G_CALLBACK(permissionrequested), c);
g_signal_connect(G_OBJECT(v), "ready-to-show",
G_CALLBACK(showview), c);
+ g_signal_connect(G_OBJECT(v), "web-process-terminated",
+ G_CALLBACK(webprocessterminated), c);
return v;
}
@@ -1692,6 +1697,15 @@ download(Client *c, WebKitURIResponse *r)
}
void
+webprocessterminated(WebKitWebView *v, WebKitWebProcessTerminationReason r,
+ Client *c)
+{
+ fprintf(stderr, "web process terminated: %s\n",
+ r == WEBKIT_WEB_PROCESS_CRASHED ? "crashed" : "no memory");
+ closeview(v, c);
+}
+
+void
closeview(WebKitWebView *v, Client *c)
{
gtk_widget_destroy(c->win);