[recipes] Avoid a crash with download cancellation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Avoid a crash with download cancellation
- Date: Tue, 11 Apr 2017 16:02:14 +0000 (UTC)
commit 4640a01f5d06e8bc8a7193b0937ee08621c2a69b
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 11 11:59:08 2017 -0400
Avoid a crash with download cancellation
We cancel any in-flight SoupMessages when a GrImage
object is finalized, but it turns out that the callback
may still get called after the image has been fully
finalized. In that case, trying to clean up will have
bad consequences, so just return right away.
src/gr-image.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gr-image.c b/src/gr-image.c
index e220296..a26db44 100644
--- a/src/gr-image.c
+++ b/src/gr-image.c
@@ -65,9 +65,6 @@ gr_image_finalize (GObject *object)
{
GrImage *ri = GR_IMAGE (object);
- g_list_free_full (ri->pending, task_data_free);
- ri->pending = NULL;
-
if (ri->thumbnail_message)
soup_session_cancel_message (ri->session,
ri->thumbnail_message,
@@ -82,6 +79,9 @@ gr_image_finalize (GObject *object)
g_free (ri->path);
g_free (ri->id);
+ g_list_free_full (ri->pending, task_data_free);
+ ri->pending = NULL;
+
G_OBJECT_CLASS (gr_image_parent_class)->finalize (object);
}
@@ -317,7 +317,7 @@ set_image (SoupSession *session,
if (msg->status_code == SOUP_STATUS_CANCELLED || ri->session == NULL) {
g_debug ("Message cancelled");
- goto error;
+ return;
}
if (msg == ri->thumbnail_message)
@@ -394,7 +394,6 @@ out:
if (ri->thumbnail_message || ri->image_message)
return;
-error:
g_list_free_full (ri->pending, task_data_free);
ri->pending = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]