diff options
author | Tim Janik <timj@gtk.org> | 1999-03-09 00:21:31 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1999-03-09 00:21:31 +0000 |
commit | 8556b646544ed641b8e4361d38a2eb4e3d74ec38 (patch) | |
tree | d1b1c4d677f2ba2fd7847058ba297d9709e6a43a | |
parent | 12d38df79e495a90f86b3a7c5033e879b4c08019 (diff) | |
download | gdk-pixbuf-8556b646544ed641b8e4361d38a2eb4e3d74ec38.tar.gz |
first lookup the xfont ID in our font hash table, if we have a
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 10 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 10 | ||||
-rw-r--r-- | gdk/gdkfont.c | 34 | ||||
-rw-r--r-- | gdk/x11/gdkfont-x11.c | 34 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 1 |
10 files changed, 115 insertions, 24 deletions
@@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cde57e13b..c10849567 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org> + + * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our + font hash table, if we have a GdkFontPrivate entry for this font + already, simply increment its reference count, provided by Olaf Dietsche + <olaf.dietsche+list.gtk@netcologne.de>. + + * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix + provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>. + Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.c: diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c index 91e728c59..d1f779a06 100644 --- a/gdk/gdkfont.c +++ b/gdk/gdkfont.c @@ -34,27 +34,37 @@ gdk_font_load (const gchar *font_name) { GdkFont *font; GdkFontPrivate *private; + XFontStruct *xfont; - private = g_new (GdkFontPrivate, 1); - font = (GdkFont*) private; + g_return_val_if_fail (font_name != NULL, NULL); - private->xdisplay = gdk_display; - private->xfont = XLoadQueryFont (private->xdisplay, font_name); - private->ref_count = 1; + xfont = XLoadQueryFont (gdk_display, font_name); + if (xfont == NULL) + return NULL; - if (!private->xfont) + font = gdk_font_lookup (xfont->fid); + if (font != NULL) { - g_free (font); - return NULL; + private = (GdkFontPrivate *) font; + if (xfont != private->xfont) + XFreeFont (gdk_display, xfont); + + gdk_font_ref (font); } else { + private = g_new (GdkFontPrivate, 1); + private->xdisplay = gdk_display; + private->xfont = xfont; + private->ref_count = 1; + + font = (GdkFont*) private; font->type = GDK_FONT_FONT; - font->ascent = ((XFontStruct *) private->xfont)->ascent; - font->descent = ((XFontStruct *) private->xfont)->descent; - } + font->ascent = xfont->ascent; + font->descent = xfont->descent; - gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font); + gdk_xid_table_insert (&xfont->fid, font); + } return font; } diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index 91e728c59..d1f779a06 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -34,27 +34,37 @@ gdk_font_load (const gchar *font_name) { GdkFont *font; GdkFontPrivate *private; + XFontStruct *xfont; - private = g_new (GdkFontPrivate, 1); - font = (GdkFont*) private; + g_return_val_if_fail (font_name != NULL, NULL); - private->xdisplay = gdk_display; - private->xfont = XLoadQueryFont (private->xdisplay, font_name); - private->ref_count = 1; + xfont = XLoadQueryFont (gdk_display, font_name); + if (xfont == NULL) + return NULL; - if (!private->xfont) + font = gdk_font_lookup (xfont->fid); + if (font != NULL) { - g_free (font); - return NULL; + private = (GdkFontPrivate *) font; + if (xfont != private->xfont) + XFreeFont (gdk_display, xfont); + + gdk_font_ref (font); } else { + private = g_new (GdkFontPrivate, 1); + private->xdisplay = gdk_display; + private->xfont = xfont; + private->ref_count = 1; + + font = (GdkFont*) private; font->type = GDK_FONT_FONT; - font->ascent = ((XFontStruct *) private->xfont)->ascent; - font->descent = ((XFontStruct *) private->xfont)->descent; - } + font->ascent = xfont->ascent; + font->descent = xfont->descent; - gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font); + gdk_xid_table_insert (&xfont->fid, font); + } return font; } diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 02766dd1d..2c8d8e1fb 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -362,6 +362,7 @@ gtk_style_copy (GtkStyle *style) new_style->bg_pixmap[i] = style->bg_pixmap[i]; } + gdk_font_unref (new_style->font); new_style->font = style->font; gdk_font_ref (new_style->font); |