Fixing Memory leak
authorMichael Cross <mc@xi2.org>
Fri, 19 Aug 2016 06:03:41 +0000 (07:03 +0100)
committerKlaus Ethgen <Klaus@Ethgen.de>
Fri, 19 Aug 2016 06:03:41 +0000 (07:03 +0100)
I also suffer from what I believe is this bug. It was not present in
geeqie 1.0 and was simple for me to reproduce in 1.2+. I open a
directory containing a few thousand jpg files of around 100k each and
just keep hitting the key for "Next Image". After around a minute my
computer will freeze.

Given this reproducibility, I ran git bisect and found the commit that
introduced the behaviour for me was the following

    commit b4c4a924121c3aa6b2f1eb7570dd3f419d2f4d83
    Author: Vladimir Nadvornik <nadvornik@suse.cz>
    Date:   Thu Aug 2 00:15:16 2012 +0200

        use cairo for drawing

I then noticed what I think is a missing cairo_destroy call in
cellrenderericon.c. The following patch solves the problem completely
for me as far as I can tell.

src/cellrenderericon.c

index ad00dae..e4d0729 100644 (file)
@@ -690,7 +690,11 @@ gqv_cell_renderer_icon_render(GtkCellRenderer              *cell,
        pixbuf = cellicon->pixbuf;
        text = cellicon->text;
 
-       if (!pixbuf && !text) return;
+       if (!pixbuf && !text)
+               {
+               cairo_destroy(cr);
+               return;
+               }
 
        gtk_cell_renderer_get_padding(cell, &xpad, &ypad);