forked from AuroraMiddleware/gtk
Don't leak built-in cursors.
2001-01-23 <alexl@redhat.com> * linux-fb/gdkcursor-fb.c: Don't leak built-in cursors. * linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon): Don't leak tmp_points. * linux-fb/gdkfont-fb.c (gdk_font_from_description): Don't modify desc. Don't leak font if the PangoFont isn't found. * linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize): Free dash_list. * linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key): Don't leak string.
This commit is contained in:
parent
18742b1dc3
commit
c181cd8efc
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -1,3 +1,21 @@
|
||||
2001-01-23 <alexl@redhat.com>
|
||||
|
||||
* linux-fb/gdkcursor-fb.c:
|
||||
Don't leak built-in cursors.
|
||||
|
||||
* linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_polygon):
|
||||
Don't leak tmp_points.
|
||||
|
||||
* linux-fb/gdkfont-fb.c (gdk_font_from_description):
|
||||
Don't modify desc. Don't leak font if the PangoFont
|
||||
isn't found.
|
||||
|
||||
* linux-fb/gdkgc-fb.c (gdk_fb_gc_finalize):
|
||||
Free dash_list.
|
||||
|
||||
* linux-fb/gdkkeyboard-fb.c (gdk_fb_handle_key):
|
||||
Don't leak string.
|
||||
|
||||
2001-01-20 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtktexttag.h (enum GtkWrapMode): rename member fields
|
||||
|
@ -33,7 +33,7 @@
|
||||
static struct {
|
||||
const guchar *bits;
|
||||
int width, height, hotx, hoty;
|
||||
GdkPixmap *pm;
|
||||
GdkCursor *cursor;
|
||||
} stock_cursors[] = {
|
||||
{X_cursor_bits, X_cursor_width, X_cursor_height, X_cursor_x_hot, X_cursor_y_hot},
|
||||
{X_cursor_mask_bits, X_cursor_mask_width, X_cursor_mask_height, X_cursor_mask_x_hot, X_cursor_mask_y_hot},
|
||||
@ -194,21 +194,24 @@ static struct {
|
||||
GdkCursor*
|
||||
gdk_cursor_new (GdkCursorType cursor_type)
|
||||
{
|
||||
GdkPixmap *tmp_pm, *pm, *mask;
|
||||
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (cursor_type >= sizeof(stock_cursors)/sizeof(stock_cursors[0]))
|
||||
return NULL;
|
||||
|
||||
pm = stock_cursors[cursor_type].pm;
|
||||
if (!pm)
|
||||
cursor = stock_cursors[cursor_type].cursor;
|
||||
if (!cursor)
|
||||
{
|
||||
GdkPixmap *tmp_pm, *pm, *mask;
|
||||
GdkGC *copy_gc;
|
||||
char *data;
|
||||
|
||||
tmp_pm = gdk_bitmap_create_from_data (gdk_parent_root,
|
||||
stock_cursors[cursor_type].bits,
|
||||
stock_cursors[cursor_type].width,
|
||||
stock_cursors[cursor_type].height);
|
||||
|
||||
/* Create an empty bitmap the size of the mask */
|
||||
data = g_malloc0 (((stock_cursors[cursor_type+1].width+7)/8) * stock_cursors[cursor_type+1].height);
|
||||
pm = gdk_bitmap_create_from_data (gdk_parent_root,
|
||||
data,
|
||||
@ -227,24 +230,18 @@ gdk_cursor_new (GdkCursorType cursor_type)
|
||||
g_free (data);
|
||||
gdk_gc_unref (copy_gc);
|
||||
|
||||
stock_cursors[cursor_type].pm = pm;
|
||||
gdk_pixmap_ref (pm);
|
||||
}
|
||||
|
||||
mask = stock_cursors[cursor_type+1].pm;
|
||||
if (!mask)
|
||||
{
|
||||
mask = stock_cursors[cursor_type+1].pm = gdk_bitmap_create_from_data (gdk_parent_root,
|
||||
stock_cursors[cursor_type+1].bits,
|
||||
stock_cursors[cursor_type+1].width,
|
||||
stock_cursors[cursor_type+1].height);
|
||||
gdk_pixmap_ref (mask);
|
||||
}
|
||||
mask = gdk_bitmap_create_from_data (gdk_parent_root,
|
||||
stock_cursors[cursor_type+1].bits,
|
||||
stock_cursors[cursor_type+1].width,
|
||||
stock_cursors[cursor_type+1].height);
|
||||
|
||||
|
||||
return gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
|
||||
cursor = gdk_cursor_new_from_pixmap (pm, mask, NULL, NULL,
|
||||
stock_cursors[cursor_type+1].hotx,
|
||||
stock_cursors[cursor_type+1].hoty);
|
||||
|
||||
stock_cursors[cursor_type].cursor = cursor;
|
||||
}
|
||||
return gdk_cursor_ref (cursor);
|
||||
}
|
||||
|
||||
GdkCursor*
|
||||
@ -282,6 +279,10 @@ _gdk_cursor_destroy (GdkCursor *cursor)
|
||||
|
||||
private = (GdkCursorPrivateFB *) cursor;
|
||||
|
||||
if (private->mask)
|
||||
gdk_pixmap_unref (private->mask);
|
||||
gdk_pixmap_unref (private->cursor);
|
||||
|
||||
g_free (private);
|
||||
}
|
||||
|
||||
|
@ -1071,12 +1071,14 @@ gdk_fb_draw_polygon (GdkDrawable *drawable,
|
||||
else
|
||||
{
|
||||
gint tmp_npoints;
|
||||
gboolean free_points = FALSE;
|
||||
GdkPoint *tmp_points;
|
||||
|
||||
if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
|
||||
{
|
||||
tmp_npoints = npoints + 1;
|
||||
tmp_points = g_new (GdkPoint, tmp_npoints);
|
||||
free_points = TRUE;
|
||||
memcpy (tmp_points, points, sizeof(GdkPoint) * npoints);
|
||||
tmp_points[npoints].x = points[0].x;
|
||||
tmp_points[npoints].y = points[0].y;
|
||||
@ -1088,6 +1090,9 @@ gdk_fb_draw_polygon (GdkDrawable *drawable,
|
||||
}
|
||||
|
||||
gdk_fb_draw_lines (drawable, gc, tmp_points, tmp_npoints);
|
||||
|
||||
if (free_points)
|
||||
g_free (tmp_points);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,7 @@ gdk_font_from_description (PangoFontDescription *desc)
|
||||
pango_font = pango_context_load_font (context, desc);
|
||||
if (!pango_font)
|
||||
{
|
||||
desc = pango_font_description_copy (desc);
|
||||
g_free (desc->family_name);
|
||||
desc->family_name = g_strdup ("sans");
|
||||
pango_font = pango_context_load_font (context, desc);
|
||||
@ -120,12 +121,16 @@ gdk_font_from_description (PangoFontDescription *desc)
|
||||
desc->stretch = PANGO_STRETCH_NORMAL;
|
||||
pango_font = pango_context_load_font (context, desc);
|
||||
}
|
||||
pango_font_description_free (desc);
|
||||
}
|
||||
|
||||
g_assert (pango_font != NULL);
|
||||
|
||||
if (pango_font == NULL)
|
||||
return NULL;
|
||||
{
|
||||
g_free (private);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
metrics.ascent = 0;
|
||||
metrics.descent = 0;
|
||||
|
@ -111,6 +111,8 @@ gdk_fb_gc_finalize (GObject *obj)
|
||||
if (private->values.tile)
|
||||
gdk_pixmap_unref (private->values.tile);
|
||||
|
||||
g_free (private->dash_list);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
|
@ -386,6 +386,8 @@ gdk_fb_handle_key (guint hw_keycode,
|
||||
event->key.hardware_keycode = hw_keycode;
|
||||
event->key.group = group;
|
||||
}
|
||||
else
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user