Re: GSlice: MemChecker: error



On Tue, Apr 28, 2009 at 1:43 PM, Colin Clark <cclark mcb net> wrote:
I have encountered a problem with some software I am trying to  write that uses libchamplain.
Using the launcher-gtk demo program I can reproduce some effects that might be causing the problem.

If I set the environment variable G_SLICE= debug-blocks, launcher-gtk immediately crashes with the error:

GSlice: MemChecker: attempt to release non-allocated block: 0xa198d18 size=4

I have attached a stack trace also.

It seems to me that when champlain_marker_new creates a new clutter_actor, ->color and ->text_color are not null. The first call to champlain_marker_set_color then tries to free memory that has not been allocated.
Is this happening with the latest version of libchamplain? We have been busy fixing a lot of memory errors and corruption this last days.

I've looked at the code of champlain_marker_init() and the only thing that I see is that the color is created with g_new0(ClutterColor, 1) and that champlain_marker_set_color frees the last color with clutter_color_free (). The problem I see for now is that the first color is created with g_new0 instead of clutter_color_copy, this might seem not important but the documentation of .clutter_color_free() says:  Frees a color structure created with clutter_color_copy().

If the clutter folks added clutter_color_free it's probably because the g_new() and clutter_color_copy behave differently. Perhaps, the function champlain_marker_init() should be modified to do:

ClutterColor color;

clutter_color_parse("#333", &color);
priv->color = clutter_color_copy(&color);

clutter_color_parse("#eee", &color);
priv->text_color = clutter_color_copy(&color);
 


I apologise if this is a nonsensical report. This is my first involvement with this kind of programming, and I am still trying to find my way around.


Colin Clark


--
Emmanuel Rodriguez


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