[cairo-commit] 2 commits - src/cairo-xlib-screen.c

Carl Worth cworth at kemper.freedesktop.org
Thu Apr 12 12:34:50 PDT 2007


 src/cairo-xlib-screen.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

New commits:
diff-tree c5b2f9d5c22c2259a11f0cbfbca8128cd3ac5794 (from 8c9f0f607b992c47b555b5eaff3c599a8c1eac57)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Apr 12 01:22:49 2007 +0100

    cairo_xlib_screen_info_t - always perform an exact match
    
    This ensures that only one cairo_xlib_screen_info_t holds the
    close_display_hooks, an assumption used later.

diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index 37f5852..749ad4e 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -320,7 +320,7 @@ _cairo_xlib_screen_info_get_unlocked (Di
     {
 	if (info->display == dpy) {
 	    seen_display = TRUE;
-	    if (info->screen == screen || screen == NULL) {
+	    if (info->screen == screen) {
 		/*
 		 * MRU the list
 		 */
diff-tree 8c9f0f607b992c47b555b5eaff3c599a8c1eac57 (from dc1de86680b59def00ce1e9f11997cf554cdfec1)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Apr 12 01:21:03 2007 +0100

    cairo-xlib-screen - avoid dereferencing a NULL screen.
    
    Do not initialize font options when setting up the
    cairo_xlib_screen_info_t corresponding to the display itself and not
    associated with any screen. This avoids a potential NULL dereferences.
    
    (Fixes https://bugs.freedesktop.org/show_bug.cgi?id=10517)

diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index fff273d..37f5852 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -237,7 +237,6 @@ _cairo_xlib_init_screen_font_options (ca
 	antialias = CAIRO_ANTIALIAS_NONE;
     }
 
-    _cairo_font_options_init_default (&info->font_options);
     cairo_font_options_set_hint_style (&info->font_options, hint_style);
     cairo_font_options_set_antialias (&info->font_options, antialias);
     cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
@@ -354,12 +353,15 @@ _cairo_xlib_screen_info_get_unlocked (Di
 
     info->display = dpy;
     info->screen = screen;
-    info->has_render = (XRenderQueryExtension (dpy, &event_base, &error_base) &&
-			(XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0));
-
     info->close_display_hooks = NULL;
+    info->has_render = FALSE;
+    _cairo_font_options_init_default (&info->font_options);
 
-    _cairo_xlib_init_screen_font_options (info);
+    if (screen) {
+	info->has_render = (XRenderQueryExtension (dpy, &event_base, &error_base) &&
+			    (XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0));
+	_cairo_xlib_init_screen_font_options (info);
+    }
 
     info->next = _cairo_xlib_screen_list;
     _cairo_xlib_screen_list = info;


More information about the cairo-commit mailing list