[yelp] Don't crash when doing stuff to empty windows
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Don't crash when doing stuff to empty windows
- Date: Fri, 17 Feb 2012 15:58:14 +0000 (UTC)
commit f83d1639f84590bbc939416f55b795068f4c6ea5
Author: Shaun McCance <shaunm gnome org>
Date: Fri Feb 17 10:57:51 2012 -0500
Don't crash when doing stuff to empty windows
src/yelp-application.c | 9 +++++++++
src/yelp-window.c | 3 ++-
2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 4aafade..057cafd 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -543,6 +543,9 @@ yelp_application_add_bookmark (YelpBookmarks *bookmarks,
GSettings *settings;
YelpApplication *app = YELP_APPLICATION (bookmarks);
+ g_return_if_fail (page_id);
+ g_return_if_fail (doc_uri);
+
settings = application_get_doc_settings (app, doc_uri);
if (settings) {
@@ -788,7 +791,13 @@ window_resized (YelpWindow *window,
GSettings *settings;
uri = yelp_window_get_uri (window);
+ if (uri == NULL)
+ return FALSE;
doc_uri = yelp_uri_get_document_uri (uri);
+ if (doc_uri == NULL) {
+ g_object_unref (uri);
+ return FALSE;
+ }
settings = g_hash_table_lookup (priv->docsettings, doc_uri);
if (settings) {
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 98570c2..7f1889a 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -562,6 +562,7 @@ window_construct (YelpWindow *window)
g_signal_connect (priv->view, "notify::yelp-uri", G_CALLBACK (view_uri_selected), window);
g_signal_connect_swapped (priv->view, "notify::page-id",
G_CALLBACK (window_set_bookmark_action), window);
+ window_set_bookmark_action (window);
g_signal_connect (priv->view, "notify::root-title", G_CALLBACK (view_root_title), window);
gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (priv->view));
gtk_widget_grab_focus (GTK_WIDGET (priv->view));
@@ -910,7 +911,7 @@ window_set_bookmark_action (YelpWindow *window)
"yelp-uri", &uri,
"page-id", &page_id,
NULL);
- if (page_id == NULL) {
+ if (page_id == NULL || uri == NULL) {
gtk_action_set_sensitive (action_add, FALSE);
gtk_action_set_sensitive (action_del, FALSE);
goto done;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]