Re: Leak in nautilus-main.c



tor, 27,.01.2005 kl. 12.27 +0100, skrev Alexander Larsson:
> On Wed, 2005-01-26 at 14:58 +0100, Kjartan Maraas wrote:
> 
> > The code is:
> > 
> >                 for (j = 0; j < G_N_ELEMENTS(sizes); j++) {
> >                         info = gtk_icon_theme_lookup_icon (icon_theme, icons_to_register[i], sizes[j].pixel, 0);
> > 
> >                         if (info != NULL &&
> >                             (sizes[j].gtk == 0 ||
> >                              gtk_icon_info_get_base_size (info) == sizes[j].pixel)) {
> >                                 icon = gtk_icon_info_get_filename (info);
> >                                 gtk_icon_source_set_filename (source, icon);
> >                                 if (sizes[j].gtk == 0) {
> >                                         gtk_icon_source_set_size (source, 0);
> >                                         gtk_icon_source_set_size_wildcarded (source, TRUE);
> >                                 } else {
> >                                         gtk_icon_source_set_size (source, sizes[j].gtk);
> >                                         gtk_icon_source_set_size_wildcarded (source, FALSE);
> >                                 }
> >                                 gtk_icon_set_add_source (set, source);
> >                                 gtk_icon_info_free (info);
> >                         }
> >                 }
> > 
> > Could it be that the condition is stopping the icon_info from being
> > free'd and that the call to gtk_icon_info_free() should be moved out one
> > level so that it's called always?
> 
> Not always, only if info != NULL. but otherwise that sounds right.
> 
I'll commit this then:

diff -u -p -r1.141 nautilus-main.c
--- nautilus-main.c     18 Jan 2005 08:43:55 -0000      1.141
+++ nautilus-main.c     27 Jan 2005 12:55:19 -0000
@@ -172,8 +172,8 @@ register_icons (void)
                                        gtk_icon_source_set_size_wildcarded (source, FALSE);
                                }
                                gtk_icon_set_add_source (set, source);
-                               gtk_icon_info_free (info);
                        }
+                       gtk_icon_info_free (info);
                }

Cheers
Kjartan





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