I Found a Bug?

<[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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: [email protected]
Address: Zhongguancun Street, Haidian District, Beijing, No. 45 XingFa
Building, Room 501
Postal Code: 100086

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.