diff options
author | Sergio Villar Senin <svillar@igalia.com> | 2012-08-24 18:14:05 +0800 |
---|---|---|
committer | Sergio Villar Senin <svillar@igalia.com> | 2012-09-03 18:15:59 +0800 |
commit | b0c5be1011f5fed19c6979b63e9d12475fd381d3 (patch) | |
tree | 22c661dfc0dcfc4c010e3ff77249290e377e7eff /src/bookmarks/ephy-bookmarks-editor.c | |
parent | c077cdea4bcdb95b58b7fff0b9dc7cce3aaa2982 (diff) | |
download | gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar.gz gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar.bz2 gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar.lz gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar.xz gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.tar.zst gsoc2013-epiphany-b0c5be1011f5fed19c6979b63e9d12475fd381d3.zip |
ephy-bookmarks-editor: repaint the favicon on "icon-loaded"
Fixes a crash when epy is started with the bookmarks window open. The old
code was trying to set the favicon in an already released GValue. Instead of
doing that, we now force a repaint of the row once we get the favicon.
https://bugzilla.gnome.org/show_bug.cgi?id=673795
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index eeeecac97..221ab9aeb 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -1474,13 +1474,25 @@ webkit_favicon_database_has_favicon (WebKitFaviconDatabase *database, const char } static void -icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GValue *value) +icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GtkTreeRowReference *reference) { GdkPixbuf *favicon = webkit_favicon_database_get_favicon_pixbuf_finish (database, result, NULL); - if (!favicon) - return; - g_value_take_object (value, favicon); + if (favicon && gtk_tree_row_reference_valid (reference)) { + GtkTreeModel *model = gtk_tree_row_reference_get_model (reference); + GtkTreePath *path = gtk_tree_row_reference_get_path (reference); + GtkTreeIter iter; + + /* Force repaint. */ + if (gtk_tree_model_get_iter (model, &iter, path)) + gtk_tree_model_row_changed (model, path, &iter); + + gtk_tree_path_free (path); + } + + gtk_tree_row_reference_free (reference); + if (favicon) + g_object_unref (favicon); } #endif @@ -1506,10 +1518,24 @@ provide_favicon (EphyNode *node, GValue *value, gpointer user_data) favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, page_location, FAVICON_SIZE, FAVICON_SIZE); - if (!favicon && webkit_favicon_database_has_favicon (database, page_location)) - webkit_favicon_database_get_favicon_pixbuf (database, page_location, - FAVICON_SIZE, FAVICON_SIZE, NULL, - (GAsyncReadyCallback) icon_loaded_cb, value); + if (!favicon && webkit_favicon_database_has_favicon (database, page_location)) { + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (user_data)); + GtkTreeIter iter; + + if (ephy_node_view_get_iter_for_node (EPHY_NODE_VIEW (user_data), &iter, node)) { + GtkTreeRowReference *reference; + GtkTreePath *path; + + path = gtk_tree_model_get_path (model, &iter); + reference = gtk_tree_row_reference_new (model, path); + gtk_tree_path_free (path); + + webkit_favicon_database_get_favicon_pixbuf (database, page_location, + FAVICON_SIZE, FAVICON_SIZE, NULL, + (GAsyncReadyCallback) icon_loaded_cb, + reference); + } + } } g_value_init (value, GDK_TYPE_PIXBUF); |