Problem with gtk+-0.99.8, Digital UNIX 4.0d and input contexts



Greetings,

After playing with gtk+-0.99.8 on a Digital UNIX 4.0d system,
and seeing crashes in testgtk in areas related to Input Contexts,
I ask my local I18N guru if he could see what was wrong. his response:

===========

After playing with the testgtk problem, I don't think it is a problem
in the X11 library. Instead, it is the gdk code that cause the
problem.

Looking at line 517 of gtk/gtkentry.c:

  gdk_ic_set_attr (editable->ic,"preeditAttributes",
                   "foreground",
widget->style->fg[GTK_STATE_NORMAL].pixel,
                   "background",
widget->style->base[GTK_STATE_NORMAL].pixel,
                   NULL);

Four arguments are put on stack. Taking a look now at the
gdk_ic_set_attr()
proceudre:

gdk_ic_set_attr (GdkIC ic, const char *target, ...)
{
  va_list list;
  void *argsptr;
  XVaNestedList attr;
  GdkICPrivate *private;

  g_return_if_fail (ic != NULL);
  g_return_if_fail (target != NULL);

  private = (GdkICPrivate *) ic;

  va_start (list, target);
  argsptr = va_arg (list, void *);
  attr =  (XVaNestedList)&argsptr;
  va_end (list);

  XSetICValues (private->xic, target, attr, NULL);
}

The variable argsptr gets the address of the string "foreground" only,
and attr is a pointer to argsptr. I guess what the routine should do is
to put the address of the first variable argument on stack into the
attr variable. For example:

        attr = (XVaNestedList)((void **) &target + 1);

Alternatively, the routine should retrieve all the variable arguments
and
put them in an array with attr pointing to the top of the array.

By doing so, the program will run smoothly without crashing.

=====================

I made a change as is shown below, and I testgtk works much better.
Not being much of a valist hacker, this may not be the most
portable solution, but it does at least work on the DU platform.

c_set_attr (GdkIC ic, const char *target, ...)
{
  va_list list;
  void *argsptr;
  XVaNestedList attr;
  GdkICPrivate *private;

  g_return_if_fail (ic != NULL);
  g_return_if_fail (target != NULL);

  private = (GdkICPrivate *) ic;

  va_start (list, target);
  argsptr = va_arg (list, void *);
#if 0
  attr =  (XVaNestedList)&argsptr;
#else
  attr =  (XVaNestedList)((void **) &target + 1);
#endif
  va_end (list);

  XSetICValues (private->xic, target, attr, NULL);
}


thanks,
        ddhill@zk3.dec.com




--
+---------------------oOO--(_)--OOo------------------------+
|Dave Hill                (0 0)    Unix Software Group     |
|Mailstop: ZKO3-3/Y15     \//\/    (dtn) 381-2985          |
|Digital Equipment Corp.           (603 )881-2985          |
|110 Spitbrook Road       /\//\    enet: ddhill@zk3.dec.com|
|Nashua, NH 03062-2698    (0_0)    decnet: gooey::ddhill   |
+---------------------oOO--(_)--OOo------------------------+





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