[rhythmbox] fading-image: fix use-after-deref introduced in previous commit



commit b151337685eff709060e805767a9e8c067f2776d
Author: Jonathan Matthew <jonathan d14n org>
Date:   Thu Dec 5 11:53:12 2013 +1000

    fading-image: fix use-after-deref introduced in previous commit
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719514

 widgets/rb-fading-image.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/widgets/rb-fading-image.c b/widgets/rb-fading-image.c
index ed1813e..bbd953f 100644
--- a/widgets/rb-fading-image.c
+++ b/widgets/rb-fading-image.c
@@ -648,12 +648,12 @@ composite_into_current (RBFadingImage *image)
        int width;
        int height;
 
-       if (image->priv->current_pat != NULL) {
-               cairo_pattern_destroy (image->priv->current_pat);
-       }
        width = gtk_widget_get_allocated_width (GTK_WIDGET (image)) - 2 * BORDER_WIDTH;
        height = gtk_widget_get_allocated_height (GTK_WIDGET (image)) - 2 * BORDER_WIDTH;
        if (width < 1 || height < 1) {
+               if (image->priv->current_pat != NULL) {
+                       cairo_pattern_destroy (image->priv->current_pat);
+               }
                image->priv->current_pat = NULL;
                image->priv->current_width = 0;
                image->priv->current_height = 0;
@@ -667,6 +667,9 @@ composite_into_current (RBFadingImage *image)
        render_next (image, cr, width, height, FALSE);
        cairo_destroy (cr);
 
+       if (image->priv->current_pat != NULL) {
+               cairo_pattern_destroy (image->priv->current_pat);
+       }
        image->priv->current_pat = cairo_pattern_create_for_surface (dest);
        image->priv->current_width = width;
        image->priv->current_height = height;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]