From f00924b9779987565d718d48dea33f33ba0f723d Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Tue, 26 Jan 2016 04:39:25 +0300 Subject: [PATCH] Prevent a crash in the backdrop loader (Bug #12339) The loader needs to check if the loading has been canceled or has invalid data. --- src/xfce-backdrop.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c index b4c884c..9d3a217 100644 --- a/src/xfce-backdrop.c +++ b/src/xfce-backdrop.c @@ -1658,9 +1658,12 @@ xfce_backdrop_image_data_release(XfceBackdropImageData *image_data) if(!image_data) return; - /* Only set the backdrop's image_data to NULL if it's current */ - if(image_data->backdrop->priv->image_data == image_data) - image_data->backdrop->priv->image_data = NULL; + if(XFCE_IS_BACKDROP(image_data->backdrop)) { + /* Only set the backdrop's image_data to NULL if it's current */ + if(image_data->backdrop->priv->image_data == image_data) { + image_data->backdrop->priv->image_data = NULL; + } + } if(image_data->cancellable) g_object_unref(image_data->cancellable); @@ -1773,6 +1776,23 @@ xfce_backdrop_loader_size_prepared_cb(GdkPixbufLoader *loader, TRACE("entering"); + if(image_data == NULL) + return; + + /* canceled? quit now */ + if(g_cancellable_is_cancelled(image_data->cancellable)) { + xfce_backdrop_image_data_release(image_data); + g_free(image_data); + return; + } + + /* invalid backdrop? quit */ + if(!XFCE_IS_BACKDROP(backdrop)) { + xfce_backdrop_image_data_release(image_data); + g_free(image_data); + return; + } + if(backdrop->priv->image_style == XFCE_BACKDROP_IMAGE_INVALID) { g_warning("Invalid image style, setting to XFCE_BACKDROP_IMAGE_ZOOMED"); backdrop->priv->image_style = XFCE_BACKDROP_IMAGE_ZOOMED; -- 2.7.0