Re: Very strange bug - memory alignment - after upgrading to GLib 2.12.4-1



On Tue, 17 Oct 2006, Fabricio Rocha wrote:

Some days ago I have posted a piece of code and the description of a very strange bug -- up to a certain line, a guint8 variable (part of a dinamically-allocated structure) has the value 0; and after a call to gtk_combo_box_set_active, which does NOT use the mentioned variable as parameter, it gets the value 255...

Sorry, I didn't see your code, but the most likely explanation for this sort of behaviour is mismanagement of dynamically allocated memory on the part of the application programmer (you in this case, but it has been me on previous occasions!).

Suppose the guint8 variable in question is actually in a memory location that is _not_ currently "owned" by your program. A gtk function lays claim to that memory and writes onto it. "Your" guint8 is screwed. This sort of problem can be sensitive -- in a random manner -- to OS, compiler, gtk version, or whatever.

I recommend running valgrind on your program. It is very good at spotting such issues.

http://valgrind.org/

Allin Cottrell




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