g_ptr_array_sort crash
- From: Gyözö Both <gyboth bygfoot com>
- To: gtk-app-devel-list gnome org <gtk-app-devel-list gnome org>
- Subject: g_ptr_array_sort crash
- Date: Sun, 13 Feb 2005 09:06:50 +0100
hi,
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.
the crash happens in the compare function, which looks like this:
gint
player_compare_func(gconstpointer a, gconstpointer b, gpointer data)
{
const Player *pl1 = *(const Player**)a;
const Player *pl2 = *(const Player**)b;
gint type = GPOINTER_TO_INT(data);
....
(compare the structs that are pointed to)
....
}
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.
i don't have a clue what the problem could be :-( hope you have ideas.
gyözö
--
No violence, gentlemen -- no violence, I beg of you! Consider
the furniture!
-- Sherlock Holmes
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]