changeset: 222:7f1bbc29ba9a
tag: tip
user: pancake<nopcode.org>
date: Thu Sep 02 14:02:12 2010 +0200
files: surf.c
description:
fix for segfault when closing window while loading (via nibble)
diff -r dbb565b8d61c -r 7f1bbc29ba9a surf.c
--- a/surf.c Fri Jun 25 09:42:58 2010 +0200
+++ b/surf.c Thu Sep 02 14:02:12 2010 +0200
@@ -87,7 +87,7 @@
static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
static void loaduri(Client *c, const Arg *arg);
static void navigate(Client *c, const Arg *arg);
-static Client *newclient(void);
+static Client *newclient(gboolean view);
static void newwindow(Client *c, const Arg *arg);
static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
@@ -181,7 +181,7 @@
WebKitWebView *
createwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c) {
- Client *n = newclient();
+ Client *n = newclient(TRUE);
return n->view;
}
@@ -410,7 +410,7 @@
}
Client *
-newclient(void) {
+newclient(gboolean newview) {
Client *c;
WebKitWebSettings *settings;
WebKitWebFrame *frame;
@@ -454,15 +454,18 @@
/* Webview */
c->view = WEBKIT_WEB_VIEW(webkit_web_view_new());
- g_signal_connect(G_OBJECT(c->view), "title-changed", G_CALLBACK(titlechange), c);
- g_signal_connect(G_OBJECT(c->view), "hovering-over-link", G_CALLBACK(linkhover), c);
- g_signal_connect(G_OBJECT(c->view), "create-web-view", G_CALLBACK(createwindow), c);
- g_signal_connect(G_OBJECT(c->view), "new-window-policy-decision-requested", G_CALLBACK(decidewindow), c);
- g_signal_connect(G_OBJECT(c->view), "mime-type-policy-decision-requested", G_CALLBACK(decidedownload), c);
- g_signal_connect(G_OBJECT(c->view), "window-object-cleared", G_CALLBACK(windowobjectcleared), c);
- g_signal_connect(G_OBJECT(c->view), "notify::load-status", G_CALLBACK(loadstatuschange), c);
- g_signal_connect(G_OBJECT(c->view), "notify::progress", G_CALLBACK(progresschange), c);
- g_signal_connect(G_OBJECT(c->view), "download-requested", G_CALLBACK(initdownload), c);
+ /* The widget to which the widget is added will handle the signals. */
+ if (!newview){
+ g_signal_connect(G_OBJECT(c->view), "title-changed", G_CALLBACK(titlechange), c);
+ g_signal_connect(G_OBJECT(c->view), "hovering-over-link", G_CALLBACK(linkhover), c);
+ g_signal_connect(G_OBJECT(c->view), "create-web-view", G_CALLBACK(createwindow), c);
+ g_signal_connect(G_OBJECT(c->view), "new-window-policy-decision-requested", G_CALLBACK(decidewindow), c);
+ g_signal_connect(G_OBJECT(c->view), "mime-type-policy-decision-requested", G_CALLBACK(decidedownload), c);
+ g_signal_connect(G_OBJECT(c->view), "window-object-cleared", G_CALLBACK(windowobjectcleared), c);
+ g_signal_connect(G_OBJECT(c->view), "notify::load-status", G_CALLBACK(loadstatuschange), c);
+ g_signal_connect(G_OBJECT(c->view), "notify::progress", G_CALLBACK(progresschange), c);
+ g_signal_connect(G_OBJECT(c->view), "download-requested", G_CALLBACK(initdownload), c);
+ }
/* Indicator */
c->indicator = gtk_drawing_area_new();
@@ -836,7 +839,7 @@
if(i < argc)
arg.v = argv[i];
setup();
- newclient();
+ newclient(FALSE);
if(arg.v)
loaduri(clients, &arg);
gtk_main();
Received on Thu Sep 02 2010 - 14:05:28 CEST
This archive was generated by hypermail 2.2.0 : Thu Sep 02 2010 - 14:12:04 CEST