GNOME Bugzilla – Bug 562084
[PATCH] Seahorse crashes on 64-bit platforms
Last modified: 2009-02-09 17:58:26 UTC
Seahorse will crash during initialization on 64-bit platforms. The stack trace is:
+ Trace 210163
The reason for this is that when a module registers its GTypes with the seahorse registry, those 64-bit GTypes are truncated to 32-bit unsigned integers. When the GTypes are later retrieved, they no longer mapped to registered GObjects. Attached is a patch which encapsulates the GTypes into a struct. This patch is incomplete as it would require some vala work as well. However, it is a proof-of-concept of a fix which works.
Created attachment 123298 [details] [review] Fix crash on 64-bit platforms
Thank you for reporting this, but I can not reproduced it on a 64 bit platform. Could you provide more information on what is needed to reproduce this?
I think it's pretty clear that the code is wrong. If you look at how GType is defined: #if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus typedef gsize GType; #else /* for historic reasons, C++ links against gulong GTypes */ typedef gulong GType; #endif It's clear that GType is 8 bytes long on 64-bit platforms. However, you are using GUINT_TO_POINTER to convert this value to a pointer. The GUINT_TO_POINTER documentation is clear that this macro will not work on 64-bit types. In order to reproduce this, the GType values must be greater than 2^32-1. I am able to reliably reproduce this on my amd64 FreeBSD system. However, on other systems, the GType values may come in below the cutoff.
Adam: ping
At first blush, this patch looks good. However, there's been some more refactoring work and vala use has been eliminated. Could you please clean up the patch so that it applies cleanly to TRUNK and still fixes the issue?
I'm currently not using trunk, and I don't have any vala experience. The patch applied when I first submitted the bug, but even then I admitted someone with vala experience would need to shape it up.
I'm saying that vala experience is no longer required.
The same issue has been reported in telepathy-gabble. I think we could fix this in a less intrusive way by using GPOINTER_TO_SIZE and GSIZE_TO_POINTER to avoid the truncation.
Nice catch guys. I've committed a fix based on GSIZE_TO_POINTER. I couldn't duplicate this on my system, so I'd appreciate any verification that this actually fixes the problem. Much appreciated.
Thanks to the telepathy-gabble devs. I didn't known GPOINTER_TO_SIZE was a valid macro. Last I looked, I recall only seeing the INT variants.