about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-10-06 14:38:29 -0500
committerMarco Peereboom <marco@conformal.com>2011-10-06 14:38:29 -0500
commit2263b87906894bd95ef494f6ac4bdbc2b4c8410c (patch)
tree5670546720dc73bf862d185518eaf92795b5fa1d
parentfdb2f77f8be9b7bc254c35758eb15496694055ff (diff)
downloadxombrero-2263b87906894bd95ef494f6ac4bdbc2b4c8410c.tar.gz
fix a crash in go_back_for_real
Fixes FS#153
-rw-r--r--xxxterm.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/xxxterm.c b/xxxterm.c
index fa34e92..08d9007 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -1849,7 +1849,7 @@ get_uri(struct tab *t)
 	const gchar		*uri = NULL;
 
 	if (webkit_web_view_get_load_status(t->wv) == WEBKIT_LOAD_FAILED)
-		return t->tmp_uri;
+		return NULL;
 	if (t->xtp_meaning == XT_XTP_TAB_MEANING_NORMAL) {
 		uri = webkit_web_view_get_uri(t->wv);
 	} else {
@@ -4065,17 +4065,21 @@ can_go_back_for_real(struct tab *t)
 {
 	int			i;
 	WebKitWebHistoryItem	*item;
+	const gchar		*uri;
 
-	/* rely on webkit to make sure we can go backward when on an about page */
-	if (get_uri(t) == NULL || g_str_has_prefix(get_uri(t), "about:"))
-		return (webkit_web_view_can_go_forward(t->wv));
+	if (t == NULL)
+		return (FALSE);
 
+	/* rely on webkit to make sure we can go backward when on an about page */
+	uri = get_uri(t);
+	if (uri == NULL || g_str_has_prefix(uri, "about:"))
+		return (webkit_web_view_can_go_back(t->wv));
 
 	/* the back/forwars list is stupid so help determine if we can go back */
 	for (i = 0, item = webkit_web_back_forward_list_get_current_item(t->bfl);
 	    item != NULL;
 	    i--, item = webkit_web_back_forward_list_get_nth_item(t->bfl, i)) {
-		if (strcmp(webkit_web_history_item_get_uri(item), get_uri(t)))
+		if (strcmp(webkit_web_history_item_get_uri(item), uri))
 			return (TRUE);
 	}
 
@@ -4087,16 +4091,21 @@ can_go_forward_for_real(struct tab *t)
 {
 	int			i;
 	WebKitWebHistoryItem	*item;
+	const gchar		*uri;
+
+	if (t == NULL)
+		return (FALSE);
 
 	/* rely on webkit to make sure we can go forward when on an about page */
-	if (get_uri(t) == NULL || g_str_has_prefix(get_uri(t), "about:"))
+	uri = get_uri(t);
+	if (uri == NULL || g_str_has_prefix(uri, "about:"))
 		return (webkit_web_view_can_go_forward(t->wv));
 
 	/* the back/forwars list is stupid so help selecting a different item */
 	for (i = 0, item = webkit_web_back_forward_list_get_current_item(t->bfl);
 	    item != NULL;
 	    i++, item = webkit_web_back_forward_list_get_nth_item(t->bfl, i)) {
-		if (strcmp(webkit_web_history_item_get_uri(item), get_uri(t)))
+		if (strcmp(webkit_web_history_item_get_uri(item), uri))
 			return (TRUE);
 	}
 
@@ -4108,12 +4117,21 @@ go_back_for_real(struct tab *t)
 {
 	int			i;
 	WebKitWebHistoryItem	*item;
+	const gchar		*uri;
+
+	if (t == NULL)
+		return;
 
+	uri = get_uri(t);
+	if (uri == NULL) {
+		webkit_web_view_go_back(t->wv);
+		return;
+	}
 	/* the back/forwars list is stupid so help selecting a different item */
 	for (i = 0, item = webkit_web_back_forward_list_get_current_item(t->bfl);
 	    item != NULL;
 	    i--, item = webkit_web_back_forward_list_get_nth_item(t->bfl, i)) {
-		if (strcmp(webkit_web_history_item_get_uri(item), get_uri(t))) {
+		if (strcmp(webkit_web_history_item_get_uri(item), uri)) {
 			webkit_web_view_go_to_back_forward_item(t->wv, item);
 			break;
 		}
@@ -4125,12 +4143,21 @@ go_forward_for_real(struct tab *t)
 {
 	int			i;
 	WebKitWebHistoryItem	*item;
+	const gchar		*uri;
 
+	if (t == NULL)
+		return;
+
+	uri = get_uri(t);
+	if (uri == NULL) {
+		webkit_web_view_go_forward(t->wv);
+		return;
+	}
 	/* the back/forwars list is stupid so help selecting a different item */
 	for (i = 0, item = webkit_web_back_forward_list_get_current_item(t->bfl);
 	    item != NULL;
 	    i++, item = webkit_web_back_forward_list_get_nth_item(t->bfl, i)) {
-		if (strcmp(webkit_web_history_item_get_uri(item), get_uri(t))) {
+		if (strcmp(webkit_web_history_item_get_uri(item), uri)) {
 			webkit_web_view_go_to_back_forward_item(t->wv, item);
 			break;
 		}
a474dcbf1633d3b7e4e8403bbcf3e84adc90'>e295a474 ^
377a63d0 ^
























373f47c7 ^
52e2917b ^
6303e0e2 ^


377a63d0 ^











fca59a31 ^
377a63d0 ^


a978bb12 ^
377a63d0 ^





















69ac8097 ^


e1e0fda8 ^

97c5072f ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109