memory leak via gnome_canvas_item_set(..., "fill_color","RGB:5E/A0/B4") narrowed a little

I spent a little more time tracking down where the memory leak is
occurring in in bug #36939. As best as I can tell the extra memory is
allocated in gnome_canvas_text_set_arg() when the argument being processed
is "fill_color".

My suspicion is that each time
gnome_canvas_item_set(.. "fill_color"...)  is called, a new color is
allocated in a color map. I'm not sure however what routine should be
responsible for figuring out whether the color is allocated
already. In the part of the switch statement for "fill_color_gdk",
there is this variable "have_pixel" which is set in some cases. This
would lead one to think that gnome_canvas_text_set_arg() should see if
the color has been allocated.

However the lower down this can be done, probably the better.
gnome_canvas_item_set() calls gnome_canvas_get_color_pixel() which in
turn calls gdk_color_context_get_pixels().

Comments on where the right place to fix is? 

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