GNOME Bugzilla – Bug 162979
gtk+ crashes on HP-UX
Last modified: 2005-07-08 03:58:44 UTC
Any gtk program (such as gtk-demo) segfaults on startup, on HP-UX. The fault occurs in _gdk_x11_set_input_focus_safe, line 327, which is LockDisplay(dpy); dpy->lock_fns contains an invalid address. This occurs for 2.4.x and 2.6.0, but not 2.2.4 (which does work). I have tried compiling gtk and all prerequisites with HP C 11.08, HP aCC 3.57, and gcc 3.4.3, shared libraries and static, always the same result.
That sounds like a bug in the gdkasync.c code using semiprivate Xlib interfaces doesn't work on HP-UX.
I have the same problem with gtk+-2.6.7. In your opinion, who should fix the bug?
Can you investigate if lock_fns is valid after calling XInitThreads ?
Output of the program below: d=40003478 d->lock_fns=00000000 BTW, the invalid address that caused the crash looked like garbage, it was not NULL. #include <X11/Xlibint.h> int main(void) { if (XInitThreads()) { Display* d = XOpenDisplay(":0"); printf("d=%p d->lock_fns=%p\n", d, d->lock_fns); XCloseDisplay(d); } return 0; }
*** Bug 307816 has been marked as a duplicate of this bug. ***
_XDisplay Structure defined in Xlibint.h is causing the problem. Depending on the defintions of -DHPPEX and -DSHMLINK , HP-UX lockf_fns is placed in different location in Display Struct In Xlibint.h file , 78 struct _XDisplay 79 { 80 XExtData *ext_data; .... 157 KeySym lock_meaning; /* for XLookupString */ 158 struct _XLockInfo *lock; /* multi-thread state, display lock * / 159 struct _XInternalAsync *async_handlers; /* for internal async */ 160 #if !(SHMLINK || HPPEX) 161 unsigned long bigreq_size; /* max size of big requests */ 162 struct _XLockPtrs *lock_fns; /* pointers to threads functions */ ^^^^^^^^^ 163 void (*idlist_alloc)( /* XID list allocator function */ 164 #if NeedFunctionPrototypes 165 Display * /* dpy */, 166 XID * 223 #if SHMLINK || HPPEX 224 unsigned long bigreq_size; /* max size of big requests */ 225 XID resource_max; /* allocator max ID */ 226 int xcmisc_opcode; /* major opcode for XC-MISC */ 227 228 /* End of HP R5 compatible structure */ 229 230 struct _XLockPtrs *lock_fns; /* pointers to threads functions */ ^^^^^^^^^^ 231 void (*idlist_alloc)(); /* XID list allocator function */ 232 unsigned int num_lock; /* keyboard numlock modifiers */ 233 #endif /* SHMLINK || HPPEX */ X11 is built with SHMLINK & HPPEX set . But gtk is not built with these defintions & LockDisplay looking for lock_fns in a wrong location. This is causing the problem Compiling GTK with the following flags solves the problem. CFLAGS='-DHPPEX -DSHMLINK ' .
When built with those defines, gtk+-2.6.8 now works for me. Thanks.
Wierd. Should we tweak configure.in to add "-DHPPEX -DSHMLINK" to CFLAGS on HP-UX ?
These flags are applicable for all HP-UX architecture ( PA_RISC , Itanium). The configure.in file needs to be updated with these flags.
I've build gtk+-2.6.7 and now it works fine. Thanks a lot
2005-07-07 Matthias Clasen <mclasen@redhat.com> * configure.in: Add -DHPPEX -DSHMLINK to CFLAGS for HP-UX. (#162979, Paul Cornett)