[cairo] I Found a Bug?

ivan at mysher.com ivan at mysher.com
Mon Jan 21 06:37:44 PST 2013


Hi, There:

 

Sorry to bother you! But I just found a bug in my win32 program. 

 

First I create an image surface then draw some points in it, 

then I create an HDC surface, unfortunately when I call
cairo_set_source_surface(), it occurs Memory Leak!

 

I would great happy to receive your reply whatever!

 

 

First:

if (img_cr != NULL)

         {

                   cairo_destroy (img_cr);

                   img_cr = NULL;

         }

         if (img_surface != NULL)

         {

                   cairo_surface_destroy (img_surface);

                   img_surface = NULL;

         }

         if (img_surface == NULL)

         {

                   img_surface = cairo_image_surface_create
(CAIRO_FORMAT_ARGB32, 640, 480);

                   img_cr = cairo_create (img_surface);     

         }        

         cairo_set_source_rgba(img_cr, 0, 0, 0, 1.0);

         cairo_set_line_width (img_cr, 2.5);  

         for (int i = 0; i <= count - 2; i++ ) 

         {  

                   cairo_move_to(img_cr, coordx[i], coordy[i]); 

                   cairo_line_to(img_cr, coordx[i+1], coordy[i+1]);

         }

         cairo_stroke(img_cr);

 

Second:

cairo_surface_t *surface = cairo_win32_surface_create(memDC.GetSafeHdc());

         cairo_t *cr = cairo_create (surface);

         cairo_set_source_surface (cr, img_surface, 1, 1);

         cairo_paint_with_alpha (cr, 1.0);    

         cairo_destroy(cr);

         cairo_surface_destroy (surface);

 

 

Ivan Liang

Beijing Mysher Technology Co., Ltd. R & D department
Tel: (86) 10-62515078 turn 810
Fax: (86) 10-62515078
E-mail: ivan at mysher.com
Address: Zhongguancun Street, Haidian District, Beijing, No. 45 XingFa
Building, Room 501
Postal Code: 100086

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130121/1aff3950/attachment.html>


More information about the cairo mailing list