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>.
This commit is contained in:
Tim Janik 1999-03-10 01:15:03 +00:00 committed by Tim Janik
parent ac7b6805f4
commit 0c178e965c
10 changed files with 117 additions and 26 deletions

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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>.
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced

View File

@ -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
{
font->type = GDK_FONT_FONT;
font->ascent = ((XFontStruct *) private->xfont)->ascent;
font->descent = ((XFontStruct *) private->xfont)->descent;
}
private = g_new (GdkFontPrivate, 1);
private->xdisplay = gdk_display;
private->xfont = xfont;
private->ref_count = 1;
gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
font = (GdkFont*) private;
font->type = GDK_FONT_FONT;
font->ascent = xfont->ascent;
font->descent = xfont->descent;
gdk_xid_table_insert (&xfont->fid, font);
}
return font;
}

View File

@ -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
{
font->type = GDK_FONT_FONT;
font->ascent = ((XFontStruct *) private->xfont)->ascent;
font->descent = ((XFontStruct *) private->xfont)->descent;
}
private = g_new (GdkFontPrivate, 1);
private->xdisplay = gdk_display;
private->xfont = xfont;
private->ref_count = 1;
gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
font = (GdkFont*) private;
font->type = GDK_FONT_FONT;
font->ascent = xfont->ascent;
font->descent = xfont->descent;
gdk_xid_table_insert (&xfont->fid, font);
}
return font;
}

View File

@ -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);