Am Mittwoch, den 30.12.2009, 04:54 +1100 schrieb
Patrick Shirkey:
Thanks. That's a nicer way of doing things but this call segfaults
pango_layout_new(style->font_desc)
gcc tells me this:
note: expected ‘struct PangoContext *’ but argument is of type ‘struct
PangoFontDescription *’
I have replaced it with this:
pl = pango_layout_new(gtk_widget_get_pango_context(widget));
Ah, okay, I didn't really use pango_layout_new, were for do you use it ?
You have already set the Font style, why don't simply label it ?
Do you use the rect afterwards ?
>
> But still get a memory leak. This makes it happen faster than the
> previous method I was using. Back down to a couple of minutes before I
> see the leak from 10 previously.
>
>
>
>
> Patrick Shirkey
> Boost Hardware Ltd
>
>
>
> >
> > Am Mittwoch, den 30.12.2009, 01:18 +1100 schrieb Patrick Shirkey:
> >
> >> Hi,
> >>
> >> I have some code in gtk2 that is leaking and I can't fix it. Over the
> >> past two nights I have managed to get the leak down from 200MB/minute to
> >> 200MB/10 minutes but I can't get rid of it completely. It's
annoying
> >> because it increments in 200MB blocks so I have to wait for up to 10
> >> mins to see if it is fixed or not. I have tried valgrind but it
doesn't
> >> really like jack and did not give me any useful output. I have traced
> >> the leak through normal debugging and have verified that it does not
> >> happen if I disable this offending code.
> >>
> >> This code is run in the widgets realize event and the event is triggered
> >> every 500ms.
And when you use style->font_desc, you could move the font discription
to init, and change only the text every 500ms.
PangoContext *pc = gtk_widget_get_pango_context(widget);
PangoLayout *pl;
PangoFontDescription *pfd;
PangoRectangle rect;
pfd = pango_font_description_new();
pango_font_description_set_family(pfd, "sans");
pango_font_description_set_size(pfd, 8 * PANGO_SCALE);
pango_context_set_font_description(pc, pfd);
pl = pango_layout_new(pc);
pango_layout_set_text(pl, "99", -1);
pango_layout_get_pixel_extents(pl,&rect, NULL);
pango_font_description_free(pfd);
g_object_unref(pc);
If I add another
g_object_unref(pl) ;
The app code will compile but when I run it I get this segfault:
*** glibc detected *** ./src/jackeq: free(): invalid pointer:
0x0000000001b87a60 ***
I can have one g_object_unref for either pl or pc without segfaulting
but not both.
I'm pretty sure this is the last leak I have to catch for the merged
gtkmeter.c/gtkmeterscale.c and I can't release jackeq until it is fixed.
Any assistance with this one is appreciated.
Cheers.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev