Author: fejj
Date: 2007-09-18 11:16:14 -0400 (Tue, 18 Sep 2007)
New Revision: 85975

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/mango.cpp
   trunk/moon/src/text.cpp
Log:
2007-09-18  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        Continued fixes to go along with Rolf's other TextBlock leak
        fixes.

        * mango.cpp (mango_attr_foreground_new): Don't ref the fg.
        (mango_attr_foreground_destroy): Don't unref the fg.

        * text.cpp (default_foreground): Make return a static reference.
        (Layout): Don't ref the fg.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-09-18 15:10:54 UTC (rev 85974)
+++ trunk/moon/src/ChangeLog    2007-09-18 15:16:14 UTC (rev 85975)
@@ -1,3 +1,14 @@
+2007-09-18  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       Continued fixes to go along with Rolf's other TextBlock leak
+       fixes.
+
+       * mango.cpp (mango_attr_foreground_new): Don't ref the fg.
+       (mango_attr_foreground_destroy): Don't unref the fg.
+
+       * text.cpp (default_foreground): Make return a static reference.
+       (Layout): Don't ref the fg.
+
 2007-09-17  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        * font.cpp: more progress on text layout.

Modified: trunk/moon/src/mango.cpp
===================================================================
--- trunk/moon/src/mango.cpp    2007-09-18 15:10:54 UTC (rev 85974)
+++ trunk/moon/src/mango.cpp    2007-09-18 15:16:14 UTC (rev 85975)
@@ -239,9 +239,6 @@
        if (fg->element)
                fg->element->unref ();
        
-       if (fg->foreground)
-               fg->foreground->unref ();
-       
        g_free (attr);
 }
 
@@ -287,9 +284,6 @@
        if (element)
                element->ref ();
        
-       if (foreground)
-               foreground->ref ();
-       
        attr->element = element;
        attr->foreground = foreground;
        

Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp     2007-09-18 15:10:54 UTC (rev 85974)
+++ trunk/moon/src/text.cpp     2007-09-18 15:16:14 UTC (rev 85975)
@@ -79,11 +79,15 @@
 static Brush *
 default_foreground (void)
 {
-       SolidColorBrush *brush = new SolidColorBrush ();
-       Color *color = color_from_str ("black");
-       solid_color_brush_set_color (brush, color);
-       delete color;
+       static SolidColorBrush *brush = NULL;
        
+       if (!brush) {
+               brush = new SolidColorBrush ();
+               Color *color = color_from_str ("black");
+               solid_color_brush_set_color (brush, color);
+               delete color;
+       }
+       
        return (Brush *) brush;
 }
 
@@ -471,12 +475,10 @@
        Brush *fg;
        int w, h;
        
-       if (foreground == NULL) {
+       if (foreground == NULL)
                fg = default_foreground ();
-       } else {
+       else
                fg = foreground;
-               fg->ref ();
-       }
        
        if (layout == NULL)
                layout = pango_cairo_create_layout (cr);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to