Fixing the bug of surf loading undefined data in arg.

This commit is contained in:
Christoph Lohmann 2012-11-08 22:05:40 +01:00
parent d44bfb2c31
commit 244dfd3231
1 changed files with 6 additions and 4 deletions

10
surf.c
View File

@ -453,8 +453,7 @@ void
linkhover(WebKitWebView *v, const char* t, const char* l, Client *c) { linkhover(WebKitWebView *v, const char* t, const char* l, Client *c) {
if(l) { if(l) {
c->linkhover = copystr(&c->linkhover, l); c->linkhover = copystr(&c->linkhover, l);
} } else if(c->linkhover) {
else if(c->linkhover) {
free(c->linkhover); free(c->linkhover);
c->linkhover = NULL; c->linkhover = NULL;
} }
@ -504,8 +503,7 @@ loaduri(Client *c, const Arg *arg) {
/* prevents endless loop */ /* prevents endless loop */
if(c->uri && strcmp(u, c->uri) == 0) { if(c->uri && strcmp(u, c->uri) == 0) {
reload(c, &a); reload(c, &a);
} } else {
else {
webkit_web_view_load_uri(c->view, u); webkit_web_view_load_uri(c->view, u);
c->progress = 0; c->progress = 0;
c->title = copystr(&c->title, u); c->title = copystr(&c->title, u);
@ -905,6 +903,7 @@ update(Client *c) {
gtk_widget_hide_all(c->indicator); gtk_widget_hide_all(c->indicator);
t = g_strdup(c->title); t = g_strdup(c->title);
} }
gtk_window_set_title(GTK_WINDOW(c->win), t); gtk_window_set_title(GTK_WINDOW(c->win), t);
g_free(t); g_free(t);
} }
@ -944,6 +943,8 @@ int
main(int argc, char *argv[]) { main(int argc, char *argv[]) {
Arg arg; Arg arg;
memset(&arg, 0, sizeof(arg));
/* command line args */ /* command line args */
ARGBEGIN { ARGBEGIN {
case 'c': case 'c':
@ -985,6 +986,7 @@ main(int argc, char *argv[]) {
newclient(); newclient();
if(arg.v) if(arg.v)
loaduri(clients, &arg); loaduri(clients, &arg);
gtk_main(); gtk_main();
cleanup(); cleanup();