[monet/monet-xml] mn-config: ensure the stroke and fill patterns are destroyed



commit 4273884109395e3dadf1468321eee1212957e40d
Author: Thomas Wood <thos gnome org>
Date:   Sun Jul 25 18:16:28 2010 +0100

    mn-config: ensure the stroke and fill patterns are destroyed

 monet/mn-config.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/monet/mn-config.c b/monet/mn-config.c
index 0f89c69..22a2660 100644
--- a/monet/mn-config.c
+++ b/monet/mn-config.c
@@ -52,6 +52,12 @@ mn_config_free_drawing_op (MnDrawingOp *op)
       g_free (rect->height);
     }
 
+  if (op->stroke)
+    cairo_pattern_destroy (op->stroke);
+
+  if (op->fill)
+    cairo_pattern_destroy (op->fill);
+
   g_free (op);
 }
 
@@ -183,9 +189,19 @@ widget_start_element (GMarkupParseContext  *context,
       gradient = cairo_pattern_create_linear (x_1, y_1, x_2, y_2);
 
       if (!strcmp (element_name, "stroke-gradient"))
-        op->stroke = gradient;
+        {
+          if (op->stroke)
+            cairo_pattern_destroy (op->stroke);
+
+          op->stroke = gradient;
+        }
       else
-        op->fill = gradient;
+        {
+          if (op->fill)
+            cairo_pattern_destroy (op->fill);
+
+          op->fill = gradient;
+        }
 
       state.gradient = gradient;
     }



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