After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 351057 - Leak in clearlooks_style.c
Leak in clearlooks_style.c
Status: RESOLVED FIXED
Product: gtk-engines
Classification: Deprecated
Component: clearlooks
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Richard Stellingwerff
gtk-engines maintainers
Depends on:
Blocks:
 
 
Reported: 2006-08-12 16:44 UTC by Kjartan Maraas
Modified: 2006-08-13 19:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kjartan Maraas 2006-08-12 16:44:46 UTC
Found this when running gnome-system-monitor in valgrind:

==9173== 36,300 (3,120 direct, 33,180 indirect) bytes in 65 blocks are definitely lost in loss record 6,686 of 6,782
==9173==    at 0x40053D0: malloc (vg_replace_malloc.c:149)
==9173==    by 0xABD438: cairo_create (cairo.c:187)
==9173==    by 0x9A1633: gdk_cairo_create (gdkcairo.c:46)
==9173==    by 0x46E045F: ge_gdk_drawable_to_cairo (cairo-support.c:231)
==9173==    by 0x46D50BD: clearlooks_style_draw_arrow (clearlooks_style.c:1154)
==9173==    by 0x66D7B07: gtk_paint_arrow (gtkstyle.c:5756)
==9173==    by 0x658DB50: gtk_arrow_expose (gtkarrow.c:237)
==9173==    by 0x666788F: _gtk_marshal_BOOLEAN__BOXED (gtkmarshalers.c:83)
Comment 1 Andrew Johnson 2006-08-12 23:10:00 UTC
This may be some sort of cairo leak, because clearlooks does -

	cairo_t *cr = ge_gdk_drawable_to_cairo (window, area);
	.....
	cairo_destroy (cr);

There is a single cairo reference, and a single cairo destroy, and nothing directly in the clearlooks draw arrow stack is keeping an extra reference so clearlooks is doing all it is supposed to do. 

Unless an error happened during drawing so that the destroy was never reached, which would be a completely different error, I don't see how this is an engine leak.
Comment 2 Kjartan Maraas 2006-08-13 16:17:41 UTC
Hmm? It clearly returns early with this check and does not destroy the stuff allocated with ge_gdk_drawable_to_cairo()?

        if (arrow_type == (GtkArrowType)4)//NONE - new in GTK 2.10
        {
                cairo_destroy (cr);
                return;
        }

You could probably check arrow_type before allocating stuff too and not have to go through that at all when the test is true.
Comment 3 Kjartan Maraas 2006-08-13 18:15:54 UTC
btw, the cairo_destroy() there was the one I added.
Comment 4 Andrew Johnson 2006-08-13 19:21:15 UTC
Aha. You are right. I somehow looked right past that return.

It shouldn't be creating the cairo handle first anyway, because a failed sanitized size or invalid args would cause it to skip out without freeing as well.

My bad.

Fixed.