Accepting request 128150 from GNOME:Factory
Added epiphany-fix-memory-leaks.patch to fix several memory leaks. Patches came from upstream git commits and rebased to apply cleanly to current version. Fixes bgo#677720, bgo#676484, bnc#771568. Needed for openSUSE 12.2 (forwarded request 128147 from dimstar) OBS-URL: https://build.opensuse.org/request/show/128150 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/epiphany?expand=0&rev=92
This commit is contained in:
commit
07eea42856
245
epiphany-fix-memory-leaks.patch
Normal file
245
epiphany-fix-memory-leaks.patch
Normal file
@ -0,0 +1,245 @@
|
||||
From 9954541fdc25579033d396554717b4e4c30c8cfb Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garcia Campos <cgarcia@igalia.com>
|
||||
Date: Thu, 14 Jun 2012 17:35:58 +0000
|
||||
Subject: Fix memory leak
|
||||
|
||||
---
|
||||
Index: epiphany-3.4.2/src/window-commands.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/src/window-commands.c
|
||||
+++ epiphany-3.4.2/src/window-commands.c
|
||||
@@ -370,14 +370,15 @@ download_status_changed_cb (WebKitDownlo
|
||||
EphyApplicationDialogData *data)
|
||||
{
|
||||
WebKitDownloadStatus status = webkit_download_get_status (download);
|
||||
- const char *destination;
|
||||
+ char *filename;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case WEBKIT_DOWNLOAD_STATUS_FINISHED:
|
||||
- destination = g_filename_from_uri (webkit_download_get_destination_uri (download),
|
||||
+ filename = g_filename_from_uri (webkit_download_get_destination_uri (download),
|
||||
NULL, NULL);
|
||||
- gtk_image_set_from_file (GTK_IMAGE (data->image), destination);
|
||||
+ gtk_image_set_from_file (GTK_IMAGE (data->image), filename);
|
||||
+ g_free (filename);
|
||||
break;
|
||||
case WEBKIT_DOWNLOAD_STATUS_ERROR:
|
||||
case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
|
||||
Index: epiphany-3.4.2/embed/ephy-download.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/embed/ephy-download.c
|
||||
+++ epiphany-3.4.2/embed/ephy-download.c
|
||||
@@ -184,47 +184,34 @@ ephy_download_get_content_type (EphyDown
|
||||
return content_type;
|
||||
}
|
||||
|
||||
+
|
||||
+/* Helper function to decide what EphyDownloadActionType should be the
|
||||
+ * default for the download. This implies that you want something to
|
||||
+ * happen, this function will never return EPHY_DOWNLOAD_ACTION_NONE.
|
||||
+ */
|
||||
static EphyDownloadActionType
|
||||
decide_action_from_mime (EphyDownload *ephy_download)
|
||||
{
|
||||
- WebKitNetworkResponse *response;
|
||||
- SoupMessage *message;
|
||||
- char *mime_description = NULL;
|
||||
+ char *content_type;
|
||||
GAppInfo *helper_app = NULL;
|
||||
EphyDownloadActionType action;
|
||||
- WebKitDownload *download;
|
||||
-
|
||||
- download = ephy_download_get_webkit_download (ephy_download);
|
||||
-
|
||||
- response = webkit_download_get_network_response (download);
|
||||
- message = webkit_network_response_get_message (response);
|
||||
-
|
||||
- if (message) {
|
||||
- char *content_type = ephy_download_get_content_type (ephy_download);
|
||||
|
||||
- if (content_type) {
|
||||
- mime_description = g_content_type_get_description (content_type);
|
||||
- helper_app = g_app_info_get_default_for_type (content_type, FALSE);
|
||||
+ content_type = ephy_download_get_content_type (ephy_download);
|
||||
+ if (content_type) {
|
||||
+ helper_app = g_app_info_get_default_for_type (content_type, FALSE);
|
||||
+ if (helper_app)
|
||||
+ action = EPHY_DOWNLOAD_ACTION_OPEN;
|
||||
|
||||
- if (helper_app)
|
||||
- action = EPHY_DOWNLOAD_ACTION_OPEN;
|
||||
-
|
||||
- g_free (content_type);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (mime_description == NULL) {
|
||||
- mime_description = g_strdup (C_("file type", "Unknown"));
|
||||
- action = EPHY_DOWNLOAD_ACTION_BROWSE_TO;
|
||||
+ g_free (content_type);
|
||||
}
|
||||
|
||||
- /* Sometimes downloads can have a mime_description but a NULL helper_app
|
||||
- * in that case action is never changed so DOWNLOAD_ACTION_DOWNLOAD remains
|
||||
- * as action value. This is the same response value as Save as...
|
||||
- * button, which is wrong for the Download button.
|
||||
+ /* Downloads that have no content_type, or no helper_app, are
|
||||
+ * considered unsafe/unable to open. Default them to BROWSE_TO.
|
||||
*/
|
||||
if (helper_app == NULL)
|
||||
action = EPHY_DOWNLOAD_ACTION_BROWSE_TO;
|
||||
+ else
|
||||
+ g_object_unref (helper_app);
|
||||
|
||||
return action;
|
||||
}
|
||||
Index: epiphany-3.4.2/lib/widgets/ephy-download-widget.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/lib/widgets/ephy-download-widget.c
|
||||
+++ epiphany-3.4.2/lib/widgets/ephy-download-widget.c
|
||||
@@ -135,6 +135,17 @@ download_clicked_cb (GtkButton *button,
|
||||
}
|
||||
|
||||
static void
|
||||
+update_download_icon (EphyDownloadWidget *widget)
|
||||
+{
|
||||
+ GIcon *new_icon;
|
||||
+
|
||||
+ new_icon = get_gicon_from_download (widget->priv->download);
|
||||
+ gtk_image_set_from_gicon (GTK_IMAGE (widget->priv->icon), new_icon,
|
||||
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
+ g_object_unref (new_icon);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
widget_progress_cb (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
EphyDownloadWidget *widget)
|
||||
@@ -152,9 +163,7 @@ widget_progress_cb (GObject *object,
|
||||
progress = webkit_download_get_progress (download) * 100;
|
||||
|
||||
if (progress % 10 == 0)
|
||||
- gtk_image_set_from_gicon (GTK_IMAGE (widget->priv->icon),
|
||||
- get_gicon_from_download (widget->priv->download),
|
||||
- GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
+ update_download_icon (widget);
|
||||
|
||||
time = get_remaining_time (download);
|
||||
|
||||
@@ -434,6 +443,7 @@ ephy_download_widget_new (EphyDownload *
|
||||
|
||||
char *dest, *basename;
|
||||
WebKitDownload *download;
|
||||
+ GIcon *gicon;
|
||||
|
||||
g_return_val_if_fail (EPHY_IS_DOWNLOAD (ephy_download), NULL);
|
||||
|
||||
@@ -449,8 +459,10 @@ ephy_download_widget_new (EphyDownload *
|
||||
button = totem_glow_button_new ();
|
||||
menu = gtk_button_new ();
|
||||
|
||||
- icon = gtk_image_new_from_gicon (get_gicon_from_download (ephy_download),
|
||||
- GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
+ gicon = get_gicon_from_download (ephy_download);
|
||||
+ icon = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
+ g_object_unref (gicon);
|
||||
+
|
||||
text = gtk_label_new (dest);
|
||||
gtk_misc_set_alignment (GTK_MISC (text), 0, 0.5);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ELLIPSIZE_END);
|
||||
Index: epiphany-3.4.2/src/ephy-session.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/src/ephy-session.c
|
||||
+++ epiphany-3.4.2/src/ephy-session.c
|
||||
@@ -1109,6 +1109,7 @@ write_tab (xmlTextWriterPtr writer,
|
||||
EphyEmbed *embed)
|
||||
{
|
||||
const char *address, *title;
|
||||
+ char *new_address = NULL;
|
||||
int ret;
|
||||
|
||||
ret = xmlTextWriterStartElement (writer, (xmlChar *) "embed");
|
||||
@@ -1119,10 +1120,11 @@ write_tab (xmlTextWriterPtr writer,
|
||||
* loading. */
|
||||
if (g_str_has_prefix (address, EPHY_ABOUT_SCHEME))
|
||||
{
|
||||
- address = g_strconcat ("about", address + EPHY_ABOUT_SCHEME_LEN, NULL);
|
||||
+ new_address = g_strconcat ("about", address + EPHY_ABOUT_SCHEME_LEN, NULL);
|
||||
}
|
||||
ret = xmlTextWriterWriteAttribute (writer, (xmlChar *) "url",
|
||||
- (const xmlChar *) address);
|
||||
+ (const xmlChar *) (new_address ? new_address : address));
|
||||
+ g_free (new_address);
|
||||
if (ret < 0) return ret;
|
||||
|
||||
title = ephy_web_view_get_title (ephy_embed_get_web_view (embed));
|
||||
Index: epiphany-3.4.2/src/bookmarks/ephy-bookmarks-editor.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/src/bookmarks/ephy-bookmarks-editor.c
|
||||
+++ epiphany-3.4.2/src/bookmarks/ephy-bookmarks-editor.c
|
||||
@@ -1139,9 +1139,8 @@ ephy_bookmarks_editor_update_menu (EphyB
|
||||
key_normal = (priority == EPHY_NODE_NORMAL_PRIORITY);
|
||||
|
||||
EPHY_TOPIC_ACTION_NAME_PRINTF (name, node);
|
||||
-
|
||||
- g_list_free (selected);
|
||||
}
|
||||
+ g_list_free (selected);
|
||||
|
||||
selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
|
||||
if (bmk_focus && selected)
|
||||
@@ -1154,9 +1153,8 @@ ephy_bookmarks_editor_update_menu (EphyB
|
||||
mutable = !ephy_node_get_property_boolean (node, EPHY_NODE_BMK_PROP_IMMUTABLE);
|
||||
|
||||
EPHY_BOOKMARK_ACTION_NAME_PRINTF (name, node);
|
||||
-
|
||||
- g_list_free (selected);
|
||||
}
|
||||
+ g_list_free (selected);
|
||||
|
||||
open_in_window_label = ngettext ("Open in New _Window",
|
||||
"Open in New _Windows",
|
||||
@@ -1460,6 +1458,19 @@ node_dropped_cb (EphyNodeView *view,
|
||||
}
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+webkit_favicon_database_has_favicon (WebKitFaviconDatabase *database, const char *page_uri)
|
||||
+{
|
||||
+ gboolean result;
|
||||
+ char *uri;
|
||||
+
|
||||
+ uri = webkit_favicon_database_get_favicon_uri (database, page_uri);
|
||||
+ result = (uri != NULL);
|
||||
+ g_free (uri);
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
icon_loaded_cb (WebKitFaviconDatabase *database, GAsyncResult *result, GValue *value)
|
||||
{
|
||||
@@ -1489,7 +1500,7 @@ provide_favicon (EphyNode *node, GValue
|
||||
favicon = webkit_favicon_database_try_get_favicon_pixbuf (database, page_location,
|
||||
FAVICON_SIZE, FAVICON_SIZE);
|
||||
|
||||
- if (!favicon && webkit_favicon_database_get_favicon_uri (database, page_location))
|
||||
+ 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);
|
||||
Index: epiphany-3.4.2/src/ephy-completion-model.c
|
||||
===================================================================
|
||||
--- epiphany-3.4.2.orig/src/ephy-completion-model.c
|
||||
+++ epiphany-3.4.2/src/ephy-completion-model.c
|
||||
@@ -416,7 +416,7 @@ query_completed_cb (EphyHistoryService *
|
||||
|
||||
g_free (user_data->search_string);
|
||||
g_slice_free (FindURLsData, user_data);
|
||||
-
|
||||
+ g_list_free_full (urls, (GDestroyNotify)ephy_history_url_free);
|
||||
g_slist_free_full (list, (GDestroyNotify)free_potential_row);
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 16 06:28:41 UTC 2012 - badshah400@gmail.com
|
||||
|
||||
- Add epiphany-fix-memory-leaks.patch to fix several memory leaks
|
||||
(bgo#677720, bgo#676484, bnc#771568); patches taken from
|
||||
upstream git commits and rebased for current version.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat May 19 18:05:24 UTC 2012 - zaitor@opensuse.org
|
||||
|
||||
|
@ -26,6 +26,8 @@ Url: http://www.gnome.org/projects/epiphany/
|
||||
Source: http://download.gnome.org/sources/epiphany/3.4/%{name}-%{version}.tar.xz
|
||||
# PATCH-FEATURE-OPENSUSE epiphany-safe-one-click-install.patch bnc330070 vuntz@novell.com -- Make one-click install work with one-click
|
||||
Patch6: epiphany-safe-one-click-install.patch
|
||||
# PATCH-FIX-UPSTREAM epiphany-fix-memory-leaks.patch bnc#771568 bgo#677720 bgo#676484 badshah400@gmail.com -- Fix several memory leaks; patches taken from upstream git commits and rebased for 3.4.2
|
||||
Patch7: epiphany-fix-memory-leaks.patch
|
||||
BuildRequires: ca-certificates
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gnome-doc-utils-devel
|
||||
@ -105,6 +107,7 @@ string.
|
||||
%setup -q
|
||||
translation-update-upstream
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
%configure \
|
||||
|
Loading…
Reference in New Issue
Block a user