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:
		
							
								
								
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user