Re: g_ptr_array_sort crash



On Sun, Feb 13, 2005 at 09:06:50AM +0100, Gyözö Both wrote:
i'm sorting a pointer array and every once in a while i get a segfault.
i'm checking the pointers before sorting with
g_ptr_array_sort_with_data, and they are fine. the data i pass, an
integer (with GINT_TO_POINTER) is also all right.

...

i print out the two pointers pl1 and pl2, and mostly they are fine, but
sometimes one of them looks weird (0x049) and is obviously invalid, so
i get a segfault when the function tries to access the struct members.

as i said, the pointers in the array are all valid and ok before i call
g_ptr_array_sort.

Try valgrind, because this looks like consequences of
a memory problem that occurs elsewhere.  There are two
common problems it may not catch: overwritten stack and
wrong level of indirection (i.e., you used too much &'s
somewhere), but chances are it will find that `elsewhere'.

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



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