Comment 25 for bug 407491

Revision history for this message
Scott Howard (showard314) wrote :

All reporters have 64 bit architectures, and every computer I tested had 64 bit
architectures - and they all had this bug. I purged Ubuntu's GPM and have only
been using my own compiled git master. I added egg_debug calls to follow the
data and found something funky going on with the pointers (specifically on line
397 actions_added does not resemble the array of policies in "array").
Unfortunately, my day job prevents me from working on it as much as I'd like,
so I'll present what I have and possibly work on a patch later today - but if
the fix is obvious and easy to someone, please go ahead and do it.

This is possibly a typsetting problem on 64 bit architectures in
gpm-prefs-core.c:

lines 356-390 use:

g_ptr_array_add (array, GINT_TO_POINTER (policy));

which adds the value of "policy" (an int) into an array of pointers to longs
(GINT_TO_POINTER actually does ((gpointer) (long) (int)).

"array" is now an array of pointers to longs. The long value of each pointer is
32 bits (instead of the full 64 bits) of the value of the int "policy".

line 397:

actions_added = (GpmActionPolicy *) g_ptr_array_free (array, FALSE);

"g_ptr_array_free" returns an array of pointers to longs, which are typecasted
into an array of pointers to "GpmActionPolicy"s, which are ints. ***Therefore,
we are typecasting an array of pointers to longs to an array of pointers to
ints.*** This could be the problem.

This will only be seen in 64 bit systems since 32 bit systems have 32 bit ints
and longs while 64 bit systems have 32 bit longs and 64 bit ints.

line 399:
g_object_set_data_full (G_OBJECT (widget), "actions", (gpointer) actions_added,
(GDestroyNotify) gpm_prefs_actions_destroy_cb);

Here is where we pass actions_added to set the "actions" for each of the combo
box choices. actions added could be an array of pointers to longs typecasted to
an array of pointers to ints.