Re: Size of text



(Remember to call pango_attr_list_unref() after
pango_Layout_set_attributes())

The following code:

  p_layout = gtk_widget_create_pango_layout (drawing_area, atom->text);
  p_list = pango_attr_list_new ();
  p_attr = pango_attr_size_new ((int) (10000 * zoom));
  p_attr->start_index = 0;
  p_attr->end_index = strlen (atom->text);
  pango_attr_list_insert (p_list, p_attr);
  pango_layout_set_attributes (p_layout, p_list);
  pango_layout_get_pixel_size (p_layout, &width, &height);

  pango_attr_list_unref (p_list);

used a big number of times, is reported by memprof to have memory leaks,
becoming annoying, of size:

 1 for pango_layout_set_tex
12 for pango_attr_list_new

I do not understand, because

 - the list is unref'ed every time
 - I don't see any unref function for layouts and attributes, is it
   normal?

If you have an idea,
Thanks

-- 
François-Xavier Coudert
École normale supérieure
45, rue d'Ulm - 75005 Paris
<Francois-Xavier Coudert ens fr>



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