[epiphany/gnome-3-36] Fix crash during early exit in web app creation
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-36] Fix crash during early exit in web app creation
- Date: Tue, 21 Apr 2020 17:54:32 +0000 (UTC)
commit 54152ff9fb748906fb6be79784186e24f1791524
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Tue Apr 21 14:20:10 2020 +0200
Fix crash during early exit in web app creation
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1151
src/window-commands.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 480d32484..15abec58e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -964,17 +964,9 @@ typedef struct {
char *icon_href;
GdkRGBA icon_rgba;
GCancellable *cancellable;
+ WebKitDownload *download;
} EphyApplicationDialogData;
-static void
-ephy_application_dialog_data_free (EphyApplicationDialogData *data)
-{
- g_cancellable_cancel (data->cancellable);
- g_object_unref (data->cancellable);
- g_free (data->icon_href);
- g_free (data);
-}
-
static void
rounded_rectangle (cairo_t *cr,
gdouble aspect,
@@ -1156,30 +1148,29 @@ download_failed_cb (WebKitDownload *download,
static void
download_icon_and_set_image (EphyApplicationDialogData *data)
{
- WebKitDownload *download;
char *destination, *destination_uri, *tmp_filename;
EphyEmbedShell *shell = ephy_embed_shell_get_default ();
- download = webkit_web_context_download_uri (ephy_embed_shell_get_web_context (shell),
- data->icon_href);
+ data->download = webkit_web_context_download_uri (ephy_embed_shell_get_web_context (shell),
+ data->icon_href);
/* We do not want this download to show up in the UI, so let's
* set 'ephy-download-set' to make Epiphany think this is
* already there. */
/* FIXME: it's probably better to just do this in a clean way
* instead of using this workaround. */
- g_object_set_data (G_OBJECT (download), "ephy-download-set", GINT_TO_POINTER (TRUE));
+ g_object_set_data (G_OBJECT (data->download), "ephy-download-set", GINT_TO_POINTER (TRUE));
tmp_filename = ephy_file_tmp_filename (".ephy-download-XXXXXX", NULL);
destination = g_build_filename (ephy_file_tmp_dir (), tmp_filename, NULL);
destination_uri = g_filename_to_uri (destination, NULL, NULL);
- webkit_download_set_destination (download, destination_uri);
+ webkit_download_set_destination (data->download, destination_uri);
g_free (destination);
g_free (destination_uri);
g_free (tmp_filename);
- g_signal_connect (download, "finished",
+ g_signal_connect (data->download, "finished",
G_CALLBACK (download_finished_cb), data);
- g_signal_connect (download, "failed",
+ g_signal_connect (data->download, "failed",
G_CALLBACK (download_failed_cb), data);
}
@@ -1377,6 +1368,22 @@ ephy_focus_desktop_app (const char *desktop_file)
g_bus_get (G_BUS_TYPE_SESSION, NULL, session_bus_ready_cb, g_strdup (desktop_file));
}
+static void
+ephy_application_dialog_data_free (EphyApplicationDialogData *data)
+{
+ if (data->download) {
+ g_signal_handlers_disconnect_by_func (data->download, download_finished_cb, data);
+ g_signal_handlers_disconnect_by_func (data->download, download_failed_cb, data);
+
+ data->download = NULL;
+ }
+
+ g_cancellable_cancel (data->cancellable);
+ g_object_unref (data->cancellable);
+ g_free (data->icon_href);
+ g_free (data);
+}
+
static void
dialog_save_as_application_response_cb (GtkDialog *dialog,
gint response,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]