Gtk2 broken on ia64 + fix



Hi all,

GTK+2  doesn't  work  on  ia64  when  compiled  with  gcc:  it  just
segfaults.

It is necessary to apply the  same fix that has been been applied to
GLib2 about one year ago:

    http://mail.gnome.org/archives/gnome-2-0-list/2001-November/msg00445.html

The  GtkFundamentalType  enum defined  in  gtktypeutils.h should  be
removed and replaced with #define's (see the fix in attachment).

Some more details:

ia64 is  one of the  architectures in which  gcc has a  64-bit "long
int"  type  (it is  32-bit  even  in  other 64-bit  platforms,  like
sparc64).

In gtktypeutils.h  the fundamental GTK_TYPE_* values  are members of
an enumeration  (GtkFundamentalType): it means that  they are 32-bit
integers.

The problem is that GtkType ==  GType == gulong, and then GtkType is
a 64-bit  type on  ia64.  When  the GTK_TYPE_* values  are put  in a
vararg function stack (e.   g.  when calling gtk_signal_new()), they
are stored as 32-bit integers  --- but later they are va_arg()'ed as
64-bit GtkType's.

So, va_arg() reads mostly random bits from the function stack.  This
junk makes  the GType system segfault while  managing the TypeNode's
tree.

The fix in attachment requires to recompile all the GTK+2-based apps
and libraries on ia64 --- but since they actually don't work at all,
it shouldn't be a problem :-)

Regards, and keep up your wonderful work with GTK+2,

alceste
-- 
This .signature is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation;  either version 2 of the License, or (at your option)
any later version.                    ___________________________________ 
______________________________________) PGP information in e-mail header |
diff -Naur gtk+-2.0.6.org/gtk/gtktypeutils.h gtk+-2.0.6/gtk/gtktypeutils.h
--- gtk+-2.0.6.org/gtk/gtktypeutils.h	2002-03-02 19:11:43.000000000 +0000
+++ gtk+-2.0.6/gtk/gtktypeutils.h	2002-10-26 08:53:51.000000000 +0000
@@ -39,27 +39,24 @@
  * many of these are just aliases for GLib types to maintain
  * compatibility
  */
-typedef enum	/*< skip >*/
-{
-  GTK_TYPE_INVALID	= G_TYPE_INVALID,
-  GTK_TYPE_NONE		= G_TYPE_NONE,
-  GTK_TYPE_ENUM		= G_TYPE_ENUM,
-  GTK_TYPE_FLAGS	= G_TYPE_FLAGS,
-
-  /* GtkArg types */
-  GTK_TYPE_CHAR		= G_TYPE_CHAR,
-  GTK_TYPE_UCHAR	= G_TYPE_UCHAR,
-  GTK_TYPE_BOOL		= G_TYPE_BOOLEAN,
-  GTK_TYPE_INT		= G_TYPE_INT,
-  GTK_TYPE_UINT		= G_TYPE_UINT,
-  GTK_TYPE_LONG		= G_TYPE_LONG,
-  GTK_TYPE_ULONG	= G_TYPE_ULONG,
-  GTK_TYPE_FLOAT	= G_TYPE_FLOAT,
-  GTK_TYPE_DOUBLE	= G_TYPE_DOUBLE,
-  GTK_TYPE_STRING	= G_TYPE_STRING,
-  GTK_TYPE_BOXED	= G_TYPE_BOXED,
-  GTK_TYPE_POINTER	= G_TYPE_POINTER
-} GtkFundamentalType;
+#define GTK_TYPE_INVALID    G_TYPE_INVALID
+#define GTK_TYPE_NONE	    G_TYPE_NONE
+#define GTK_TYPE_ENUM	    G_TYPE_ENUM
+#define GTK_TYPE_FLAGS	    G_TYPE_FLAGS
+
+/* Gtkarg types */
+#define GTK_TYPE_CHAR	    G_TYPE_CHAR
+#define GTK_TYPE_UCHAR	    G_TYPE_UCHAR
+#define GTK_TYPE_BOOL	    G_TYPE_BOOLEAN
+#define GTK_TYPE_INT	    G_TYPE_INT
+#define GTK_TYPE_UINT	    G_TYPE_UINT
+#define GTK_TYPE_LONG	    G_TYPE_LONG
+#define GTK_TYPE_ULONG	    G_TYPE_ULONG
+#define GTK_TYPE_FLOAT	    G_TYPE_FLOAT
+#define GTK_TYPE_DOUBLE	    G_TYPE_DOUBLE
+#define GTK_TYPE_STRING	    G_TYPE_STRING
+#define GTK_TYPE_BOXED	    G_TYPE_BOXED
+#define GTK_TYPE_POINTER    G_TYPE_POINTER
 
 /* --- type macros --- */
 #define GTK_CLASS_NAME(class)		(g_type_name (G_TYPE_FROM_CLASS (class)))

Attachment: pgp0WFYWQJ5Zm.pgp
Description: PGP signature



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