Re: Any problems with malloc functions?

Ken Stebbings <> writes:

> I think I have found at least part of the problem I am having:  I traced
> the program execution to here:
> (gdb) bt
> #0  gdk_wcstombs (src=0x400297f8) at gdkim.c:1481
> #1  0x7abca124 in gtk_label_paint_word (label=0x40026eac, x=55, y=3,
> word=0x4002d564, area=0x7b03b642) at gtklabel.c:886


> In the function gdk_wcstombs, the call to XwcTextListToTextProperty
> fails, and gdk_wcstombs returns null.  Bingo, a free to a non-allocated
> pointer in gtk_label_paint_word.  Here is the function:

Thanks for tracking this down!
> ***    	  if (XwcTextListToTextProperty (gdk_display, (wchar_t**)&src,
> 1,
>     					 XTextStyle, &tpr) != Success)


> The line marked with the *** is the line that is failing.  I don't have
> the xlib programming books with me right now, so I can't look up what
> this function does.  I looked at all the arguments and none are illegal
> (null).  I couldn't really see any useful info in them, so I'm not
> sending them here.  Anyone have any ideas/background that could help?

The possible failure codes here are:
       #define   XNoMemory              -1
       #define   XLocaleNotSupported    -2
       #define   XConverterNotFound     -3

I'm guessing that it isn't the first, beyond that, I
don't have much of an idea.

* First, is your $LANG environment set at all?

* Could you insert some debugging printfs to the effect of:

 gint tmp;

 tmp = XwcTextListToTextProperty ();
 g_print ("locale, failure code: %s, %d\n",
          setlocale(LC_CTYPE, NULL), tmp);

 if (tmp) 

  and see what the result is? 

* What version of X11 is installed on your system?

If there isn't an apparent cause, then what we may
want to do is if the conversion fails, just 
set "gdk_use_mb" to FALSE and fall back to that 


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