On Wed, 2008-04-30 at 19:05 +0200, Petr Sumbera wrote:
> I have tried your patch (Nevada build 83 + wine-0.9.60-525-g4992b65) 
> with little change but it still doesn't work...
> 
> Changed version:
> 
> diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c
> index a4fbdb2..d99ac5b 100644
> --- a/dlls/winex11.drv/xim.c
> +++ b/dlls/winex11.drv/xim.c
> @@ -35,8 +35,16 @@
>   WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
> 
>   #ifndef HAVE_XICCALLBACK_CALLBACK
> -#define XICCallback XIMCallback
> -#define XICProc XIMProc
> +typedef Bool (*XICProc)(
> +  XIC,
> +  XPointer,
> +  XPointer
> +);
> +
> +typedef struct {
> +  XPointer client_data;
> +  XICProc callback;
> +} XICCallback;
>   #endif
> 
>   BOOL ximInComposeMode=FALSE;
> 
> --
> 
> Petr
> 
> Suresh Chandrasekharan wrote:
> > Sorry the code fragment for xim.c contained extraneous characters, 
> > should be like this
> > 
> > #ifndef  HAVE_XICCALLBACK_CALLBACK
> > 
> > typedef struct {
> >    XPointer client_data;
> >    XICProc callback;
> > } XICCallback;
> > 
> > typedef Bool (*XICProc)(
> >    XIC,
> >    XPointer,
> >    XPointer
> > );
> > 
> > #endif


That patch might be better than the current one, but it doesn't fix the
crash in XRegisterIMInstantiateCallback.

I have attached a minimal testcase for the crash.



Curiously, there are some impedance mismatches between the prototypes in
X11R6 (used in pre-snv_85) and the ones in XFree86/Xorg that may be
related.

extern Bool XRegisterIMInstantiateCallback(
    Display*                    /* dpy */,
    struct _XrmHashBucketRec*   /* rdb */,
    char*                       /* res_name */,
    char*                       /* res_class */,
    XIMProc                     /* callback */,
    XPointer*                   /* client_data */
);

XRegisterIMInstantiateCallback passes an XIMProc as the fifth argument,
and an XPointer pointer (this part of the X11R6 spec and presumably a
mistake; Xorg uses just an XPointer) as the sixth. Xorg also uses an
XIDProc, not an XIMProc.

This is an XIMProc, notice the first argument is an XIC, which is a
typedef for a struct _XIC pointer.

typedef struct _XIC *XIC;

typedef void (*XIMProc)(
    XIC,
    XPointer,
    XPointer
);

typedef struct _XIC {
    XICMethods          methods;                /* method list of this IC */
    XICCoreRec          core;                   /* data of this IC */
} XICRec;


X11DRV_OpenIM, has this prototype:
static void X11DRV_OpenIM(Display *display, XPointer p, XPointer data);

Since the first argument is a Display pointer, X11DRV_OpenIM's signature
is not correct (for this implementation, at least).

Passing the Display pointer as XRegisterIMInstantiateCallback's sixth
(data) argument (and extracting it later) doesn't seem to help the
crash, though.

There was a similar bug way back in 2000 that alanc fixed in S8:
http://bugs.opensolaris.org/view_bug.do?bug_id=4305157

-Albert


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 598 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/xwin-discuss/attachments/20080501/1a3a942d/attachment.bin>

Reply via email to