diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-01-20 04:39:43 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-01-20 04:39:43 +0000 |
commit | c9473ebd35ac7de317ff47ddec073226e5dfdb69 (patch) | |
tree | 6696e2c4ead2771d1c348fc25735b34c4d815e13 /gdk | |
parent | d8a5439f4d7cce38175629a4dc0a25ac063f902a (diff) | |
download | gdk-pixbuf-c9473ebd35ac7de317ff47ddec073226e5dfdb69.tar.gz |
Use an unused high bit in the XID to mark fonts in the global xid hash
2006-01-19 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkprivate-x11.h (XID_FONT_BIT):
* gdk/x11/gdkfont-x11.c:
* gdk/x11/gdkxid.c: Use an unused high bit in the
XID to mark fonts in the global xid hash table.
* gdk/x11/gdkcursor-x11.c (update_cursor): Skip fonts
when iterating over the xid hash table, since calling
GDK_IS_WINDOW () on an GdkFont can cause a segfault.
(#327751, Ryan Lortie)
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkcursor-x11.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkfont-x11.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkprivate-x11.h | 2 | ||||
-rw-r--r-- | gdk/x11/gdkxid.c | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index fb4f53b14..f5e8d15ea 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -430,8 +430,12 @@ update_cursor (gpointer key, gpointer value, gpointer data) { + XID *xid = key; GdkCursor *cursor; + if (*xid & XID_FONT_BIT) + return; + if (!GDK_IS_WINDOW (value)) return; diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index d4c67b401..4833283ab 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -50,6 +50,7 @@ struct _GdkFontPrivateX GdkDisplay *display; GSList *names; + XID xid; }; static GHashTable * @@ -214,13 +215,14 @@ gdk_font_load_for_display (GdkDisplay *display, private->xfont = xfont; private->base.ref_count = 1; private->names = NULL; + private->xid = xfont->fid | XID_FONT_BIT; font = (GdkFont*) private; font->type = GDK_FONT_FONT; font->ascent = xfont->ascent; font->descent = xfont->descent; - _gdk_xid_table_insert (display, &xfont->fid, font); + _gdk_xid_table_insert (display, &private->xid, font); } gdk_font_hash_insert (GDK_FONT_FONT, font, font_name); diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 5e9e2cba6..fb705c1da 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -86,6 +86,8 @@ struct _GdkVisualPrivate GdkScreen *screen; }; +#define XID_FONT_BIT (1<<31) + void _gdk_xid_table_insert (GdkDisplay *display, XID *xid, gpointer data); diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c index b192f8c8b..2c147daf2 100644 --- a/gdk/x11/gdkxid.c +++ b/gdk/x11/gdkxid.c @@ -123,7 +123,7 @@ static gboolean gdk_xid_equal (XID *a, XID *b) { - return (*a == *b); + return ((*a & ~XID_FONT_BIT) == (*b & ~XID_FONT_BIT)); } #define __GDK_XID_C__ |