From: Daniel Carl <danielcarl@gmx.de>
Date: Wed, 13 Feb 2019 21:55:43 +0000 (+0100)
Subject: Avoid double client destroy in case of webview close #537.
X-Git-Url: https://git.owens.tech/editable-focus.html/editable-focus.html/git?a=commitdiff_plain;h=82f75cd194340e68f9a1b4dc7732745546f9d7fe;p=vimb.git

Avoid double client destroy in case of webview close #537.
---

diff --git a/src/main.c b/src/main.c
index 71a4007..b2cf5c6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1195,7 +1195,7 @@ static void on_webdownload_received_data(WebKitDownload *download,
  */
 static void on_webview_close(WebKitWebView *webview, Client *c)
 {
-    client_destroy(c);
+    gtk_widget_destroy(c->window);
 }
 
 /**
diff --git a/tests/manual/js-window-close.html b/tests/manual/js-window-close.html
new file mode 100644
index 0000000..160d615
--- /dev/null
+++ b/tests/manual/js-window-close.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>JS Window Close</title>
+</head>
+<body>
+Click on following link should close the window without crashing.<br>
+<a href="#" onclick="window.close()">Close this window</a>
+</body>
+</html>