On Tue, Jun 22, 2010 at 1:53 PM, Rafa Garcia Gallego
<[email protected]> wrote:
> When loading a non-reachable URI, surf tries to load it a good number
> of times before giving up. I doubt this is intended and it gets really
> annoying as you have to browse back several times to reach the
> previous page. This tiny patch solves this and removes two (legacy?)
> unused pointers from the Client struct.
Please, ignore the original patch and use this, which also prevents a
memory leak. In my defense, the leak was there when I arrived.
Cheers,
Rafa.
diff -r e83fbd17d63a surf.c
--- a/surf.c Tue Jun 08 09:06:15 2010 +0200
+++ b/surf.c Tue Jun 22 14:13:07 2010 +0200
@@ -36,7 +36,6 @@
GtkWidget *win, *scroll, *vbox, *indicator;
WebKitWebView *view;
char *title, *linkhover;
- const char *uri, *needle;
gint progress;
struct Client *next;
gboolean zoomed;
@@ -383,6 +382,7 @@
void
loaduri(Client *c, const Arg *arg) {
char *u;
+ const char *cururi;
const char *uri = (char *)arg->v;
Arg a = { .b = FALSE };
@@ -391,16 +391,17 @@
u = g_strrstr(uri, "://") ? g_strdup(uri)
: g_strdup_printf("http://%s", uri);
/* prevents endless loop */
- if(c->uri && strcmp(u, c->uri) == 0) {
+ cururi=geturi(c);
+ if(strcmp(u, cururi) == 0) {
reload(c, &a);
}
else {
webkit_web_view_load_uri(c->view, u);
c->progress = 0;
c->title = copystr(&c->title, u);
- g_free(u);
update(c);
}
+ g_free(u);
}
void