Re: Memory ownership from pango_context_load_font(..)



Vlad,

Floating references is not my expertise.  Read the docs.

behdad

On 05/11/2009 10:40 AM, Vlad Volodin wrote:
Hello, Behdad Esfahbo

The answer is clear for me, too. But, another question. In some
sources, I saw, that people usually get references to widgets (or
GObjects in general), and some of them are made non-floating (by
g_object_ref_sink), and some a left as is.
Why? I think when I create a widget, and have a pointer to it
(GtkWidget*), and if I want to use it in future, should I left it in
floating state or not?
and the other question, why I should be sure that if I have a pointer
to widget (floating), and then using it on the second line, the
pointer will be the same? I think there is a chance that the GObject
data may be moved suddenly.

Thank you in advance,
Vlad Volodin

2009/5/11 Behdad Esfahbod<behdad behdad org>:
On 05/11/2009 02:13 AM, Martin Sevior wrote:
HI Folks,
              I'm having trouble getting to the bottom of either a
crash on exit or a memory leak issue in abiword.

I think my problem stems from the function

PangoFont * pF = pango_context_load_font( (PangoContext *context,
                                                          const
PangoFontDescription *desc);


Which returns a pointer to a PangoFont struct.

Who owns pF? Do I have to keep track of it and do a g_object_unref(pF)
when I'm finished with it?
Yes, load_font gives you a reference that you need to free.

behdad

Or will it freed when I do a g_object_unref( context)? Or is it freed
upon a different action altogether?

Thank you!

Martin Sevior
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list




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