Re: [evolution-patches] patch to fix colormap initialisation in gtkhtml's gdk painter



Hi Robert,

your patch looks good. One minor thing, please change the g_assert to g_return_if_fail and use the same indentation as in gtkhtml sources
g_return_if_fail (gdk_drawable_get_colormap (gdk_painter->pixmap) != NULL);
Once that is fixed feel free to commit. Thanks a lot for your patch.

Cheers
Radek

PS: sorry for the delay


On Fri, 2004-07-23 at 18:41 +0100, Robert McQueen wrote:
I'm working on a product which uses Balsa on a small ARM-based handheld 
device with the kdrive X server (in 16bpp). When rendering any HTML 
e-mail, balsa issued the following warning:

(balsa:11338): Gdk-WARNING **: Using Xft rendering requires the drawable
argument to have a specified colormap. All windows have a colormap,
however, pixmaps only have colormap by default if they
were created with a non-NULL window argument. Otherwise
a colormap must be set on them with gdk_drawable_set_colormap

And then crashed with backtraces along these lines:

#0  0x416754d3 in XftDrawSetClip () from /usr/lib/libXft.so.2
#1  0x40f3cab4 in _gdk_x11_have_render () from /usr/lib/libgdk-x11-2.0.so.0
#2  0x40f3d7be in _gdk_x11_have_render () from /usr/lib/libgdk-x11-2.0.so.0
#3  0x40f1800c in gdk_draw_glyphs () from /usr/lib/libgdk-x11-2.0.so.0
#4  0x40f21d15 in gdk_pixmap_get_type () from /usr/lib/libgdk-x11-2.0.so.0
#5  0x40f1800c in gdk_draw_glyphs () from /usr/lib/libgdk-x11-2.0.so.0
#6  0x40084c98 in html_gdk_painter_text_itemize_and_prepare_glyphs () 
from /usr/lib/libgtkhtml-3.0.so.4

This crash was also reproducable when running balsa on an i386, only 
displaying on the handheld. Debugging in this situation revealed that 
this crash is actually within the draw_text function in 
htmlgtkpainter.c, and that after begin() is called, the colormap of 
gdk_painter->pixmap was null.

The attached patch fixes the crash here by providing gdk_painter->window 
when initialising the pixmap, which lets Gdk find the right colormap for 
the drawable, and avoids the need to get the viewable to find the colour 
depth. Although against gtkhtml 3.0.10 the code looks the same in CVS so 
should apply fine.

The only thing I havn't yet figured out is why it crashes on this 
handheld's kdrive X server but not on any of our desktop machines 
XFree86 X servers. Maybe because they are all 32bpp? Answers on a postcard.

Regards,
Rob
--
Radek Doulík <rodo novell com>
Novell, Inc.


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