GNOME Bugzilla – Bug 143106
Crashes when accessing preferences dialog
Last modified: 2004-12-22 21:47:04 UTC
Description of Problem: When selecting Settings->Preferences, the "Application quit unexpectedly" dialog appears. Steps to reproduce the problem: 1. Start Blackjack 2. Select Settings->Preferences 3. Crash Actual Results: Application crashes Expected Results: Settings dialog appears How often does this happen? Each time Additional Information: This appears to happen only on 64-bit platforms. I'm running Linux x86_64. The bug is in card_style_file_parse in card-style-file.c. "length" is declared as gint, but g_file_get_contents takes a gsize *. This isn't a problem on 32 bit platforms, but on x86_64, gint is 4 bytes and gsize is 8 bytes. Changing "gint length" to "gsize length" fixes the problems. Although it works okay, there are other cases of casting between gints and gpointers using (gint) and (gpointer) which cause compiler warnings about incompatible types. These should be changed to GPOINTER_TO_INT(data) and GINT_TO_POINTER(data).
Created attachment 28007 [details] [review] correct data type There was no patch attached, but I assume that this is what you are talking about. I don't have a 64-bit machine to test this on, so if you could verify, that would be great. There does appear to be a more systemic problem with wonton casting between pointers and ints... certainly a Bad Thing(tm) if I ever saw one.
This is a bug in the gdk-card-image component.
We can get rid of gdk-card-image now can't we ? I mean aside from fixes for 2.6 neither aisleriot or blackjack use it right ? As for the rest of the 64-bit stuff, I do have a 64-bit machine but my hacking time has been taken up with finding 64-bit bugs in every module but my own one :). I'll be going over it soon, but not for a day or so. Work and all that.
Yes, that patch resolved the problem. The other pointer cases are mostly where an int is cast to a pointer and back, rather than trying to store a pointer in an int. int to pointer to int works, but causes compiler warnings. The conversion macros are really the way to go. I'm sure the new 64 bit machines are going to shake out a lot of pointers or sizes being treated as ints.
I've just gone through and fixed all the compiler warnings generated on my ppc64 system. Obviously this should work for x86_64 as well even with the endianess difference. I have also applied the gsize fix to the 2.6 branch. Back-porting the other changes can wait.