mirror of https://github.com/GNOME/gimp.git
app/text/gimptextlayout-render.c (gimp_text_layout_render)
2003-09-02 Sven Neumann <sven@gimp.org> * app/text/gimptextlayout-render.c (gimp_text_layout_render) * app/widgets/gimpfontselection.c (gimp_font_selection_set_fontname) * app/widgets/gimptexteditor.c (gimp_text_editor_new) * app/gui/file-save-dialog.c (file_save_ok_callback): plugged some memleaks found using memprof. * app/vectors/gimpvectors.c: implemented the finalize method. * app/vectors/gimpstroke.c: minor code cleanup. * app/core/gimpdrawable.c (gimp_drawable_finalize) * app/core/gimplayer.c (gimp_layer_finalize) * app/core/gimpparasitelist.c (gimp_parasite_list_finalize): removed useless assertions.
This commit is contained in:
parent
9dcece1416
commit
e924a1372b
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2003-09-02 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/text/gimptextlayout-render.c (gimp_text_layout_render)
|
||||
* app/widgets/gimpfontselection.c (gimp_font_selection_set_fontname)
|
||||
* app/widgets/gimptexteditor.c (gimp_text_editor_new)
|
||||
* app/gui/file-save-dialog.c (file_save_ok_callback): plugged
|
||||
some memleaks found using memprof.
|
||||
|
||||
* app/vectors/gimpvectors.c: implemented the finalize method.
|
||||
|
||||
* app/vectors/gimpstroke.c: minor code cleanup.
|
||||
|
||||
* app/core/gimpdrawable.c (gimp_drawable_finalize)
|
||||
* app/core/gimplayer.c (gimp_layer_finalize)
|
||||
* app/core/gimpparasitelist.c (gimp_parasite_list_finalize):
|
||||
removed useless assertions.
|
||||
|
||||
2003-09-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpmodules.c (gimp_modules_load): silently ignore a
|
||||
|
|
|
@ -135,7 +135,7 @@ gimp_drawable_get_type (void)
|
|||
};
|
||||
|
||||
drawable_type = g_type_register_static (GIMP_TYPE_ITEM,
|
||||
"GimpDrawable",
|
||||
"GimpDrawable",
|
||||
&drawable_info, 0);
|
||||
}
|
||||
|
||||
|
@ -210,11 +210,7 @@ gimp_drawable_init (GimpDrawable *drawable)
|
|||
static void
|
||||
gimp_drawable_finalize (GObject *object)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (object));
|
||||
|
||||
drawable = GIMP_DRAWABLE (object);
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (object);
|
||||
|
||||
if (drawable->tiles)
|
||||
{
|
||||
|
@ -308,13 +304,13 @@ gimp_drawable_duplicate (GimpItem *item,
|
|||
|
||||
new_drawable->visible = drawable->visible;
|
||||
|
||||
pixel_region_init (&srcPR, drawable->tiles,
|
||||
0, 0,
|
||||
pixel_region_init (&srcPR, drawable->tiles,
|
||||
0, 0,
|
||||
item->width,
|
||||
item->height,
|
||||
FALSE);
|
||||
pixel_region_init (&destPR, new_drawable->tiles,
|
||||
0, 0,
|
||||
0, 0,
|
||||
new_item->width,
|
||||
new_item->height,
|
||||
TRUE);
|
||||
|
@ -569,7 +565,7 @@ gimp_drawable_configure (GimpDrawable *drawable,
|
|||
gint offset_x,
|
||||
gint offset_y,
|
||||
gint width,
|
||||
gint height,
|
||||
gint height,
|
||||
GimpImageType type,
|
||||
const gchar *name)
|
||||
{
|
||||
|
@ -629,7 +625,7 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
|
|||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2,
|
||||
gint y2,
|
||||
TileManager *tiles,
|
||||
gboolean sparse)
|
||||
{
|
||||
|
@ -638,12 +634,12 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
|
|||
if (! tiles)
|
||||
gimp_image_undo_push_image (gimp_item_get_image (GIMP_ITEM (drawable)),
|
||||
undo_desc,
|
||||
drawable,
|
||||
drawable,
|
||||
x1, y1, x2, y2);
|
||||
else
|
||||
gimp_image_undo_push_image_mod (gimp_item_get_image (GIMP_ITEM (drawable)),
|
||||
undo_desc,
|
||||
drawable,
|
||||
drawable,
|
||||
x1, y1, x2, y2,
|
||||
tiles, sparse);
|
||||
}
|
||||
|
@ -732,7 +728,7 @@ gimp_drawable_fill (GimpDrawable *drawable,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_warning ("%s: Cannot fill unknown image type.",
|
||||
g_warning ("%s: Cannot fill unknown image type.",
|
||||
G_GNUC_PRETTY_FUNCTION);
|
||||
break;
|
||||
}
|
||||
|
@ -792,7 +788,7 @@ gimp_drawable_fill_by_type (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_drawable_mask_bounds (GimpDrawable *drawable,
|
||||
gimp_drawable_mask_bounds (GimpDrawable *drawable,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
|
|
|
@ -120,7 +120,7 @@ gimp_item_get_type (void)
|
|||
};
|
||||
|
||||
item_type = g_type_register_static (GIMP_TYPE_VIEWABLE,
|
||||
"GimpItem",
|
||||
"GimpItem",
|
||||
&item_info, 0);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ gimp_item_real_duplicate (GimpItem *item,
|
|||
|
||||
if ((strlen (name) >= len &&
|
||||
strcmp (&name[strlen (name) - len], _("copy")) == 0) ||
|
||||
(ext && (number = atoi (ext + 1)) > 0 &&
|
||||
(ext && (number = atoi (ext + 1)) > 0 &&
|
||||
((int)(log10 (number) + 1)) == strlen (ext + 1)))
|
||||
{
|
||||
/* don't have redundant "copy"s */
|
||||
|
@ -507,7 +507,7 @@ gimp_item_translate (GimpItem *item,
|
|||
*
|
||||
* Scales item dimensions, then snaps them to pixel centers
|
||||
*
|
||||
* Returns: #FALSE if any dimension reduces to zero as a result
|
||||
* Returns: #FALSE if any dimension reduces to zero as a result
|
||||
* of this; otherwise, returns #TRUE.
|
||||
**/
|
||||
gboolean
|
||||
|
@ -530,7 +530,7 @@ gimp_item_check_scaling (const GimpItem *item,
|
|||
new_item_width = ROUND (img_scale_w * (gdouble) item->width);
|
||||
new_item_height = ROUND (img_scale_h * (gdouble) item->height);
|
||||
|
||||
return (new_item_width > 0 && new_item_height > 0);
|
||||
return (new_item_width > 0 && new_item_height > 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -559,8 +559,8 @@ gimp_item_scale (GimpItem *item,
|
|||
* @item: Item to be transformed by explicit width and height factors.
|
||||
* @w_factor: scale factor to apply to width and horizontal offset
|
||||
* @h_factor: scale factor to apply to height and vertical offset
|
||||
* @interpolation:
|
||||
*
|
||||
* @interpolation:
|
||||
*
|
||||
* Scales item dimensions and offsets by uniform width and
|
||||
* height factors.
|
||||
*
|
||||
|
@ -577,8 +577,8 @@ gimp_item_scale (GimpItem *item,
|
|||
* Use gimp_item_scale() in circumstances where new item width
|
||||
* and height dimensions are predetermined instead.
|
||||
*
|
||||
* Side effects: Undo set created for item. Old item imagery
|
||||
* scaled & painted to new item tiles.
|
||||
* Side effects: Undo set created for item. Old item imagery
|
||||
* scaled & painted to new item tiles.
|
||||
*
|
||||
* Returns: #TRUE, if the scaled item has positive dimensions
|
||||
* #FALSE if the scaled item has at least one zero dimension
|
||||
|
@ -636,13 +636,13 @@ gimp_item_scale_by_factors (GimpItem *item,
|
|||
* current item dimensions, these factors will vary from
|
||||
* item to item because of aliasing artifacts; factor
|
||||
* variations among items can be quite large where item
|
||||
* dimensions approach pixel dimensions. Use
|
||||
* dimensions approach pixel dimensions. Use
|
||||
* gimp_item_scale_by_factors() where constant scales are to
|
||||
* be uniformly applied to a number of items.
|
||||
*
|
||||
* Side effects: undo set created for item.
|
||||
* Old item imagery scaled
|
||||
* & painted to new item tiles
|
||||
* Old item imagery scaled
|
||||
* & painted to new item tiles
|
||||
**/
|
||||
void
|
||||
gimp_item_scale_by_origin (GimpItem *item,
|
||||
|
@ -668,12 +668,12 @@ gimp_item_scale_by_origin (GimpItem *item,
|
|||
}
|
||||
else
|
||||
{
|
||||
new_offset_x = (gint) (((gdouble) new_width *
|
||||
(gdouble) item->offset_x /
|
||||
new_offset_x = (gint) (((gdouble) new_width *
|
||||
(gdouble) item->offset_x /
|
||||
(gdouble) item->width));
|
||||
|
||||
new_offset_y = (gint) (((gdouble) new_height *
|
||||
(gdouble) item->offset_y /
|
||||
new_offset_y = (gint) (((gdouble) new_height *
|
||||
(gdouble) item->offset_y /
|
||||
(gdouble) item->height));
|
||||
}
|
||||
|
||||
|
@ -789,14 +789,14 @@ gimp_item_get_by_ID (Gimp *gimp,
|
|||
if (gimp->item_table == NULL)
|
||||
return NULL;
|
||||
|
||||
return (GimpItem *) g_hash_table_lookup (gimp->item_table,
|
||||
return (GimpItem *) g_hash_table_lookup (gimp->item_table,
|
||||
GINT_TO_POINTER (item_id));
|
||||
}
|
||||
|
||||
GimpTattoo
|
||||
gimp_item_get_tattoo (const GimpItem *item)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), 0);
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), 0);
|
||||
|
||||
return item->tattoo;
|
||||
}
|
||||
|
|
|
@ -249,11 +249,7 @@ gimp_layer_init (GimpLayer *layer)
|
|||
static void
|
||||
gimp_layer_finalize (GObject *object)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LAYER (object));
|
||||
|
||||
layer = GIMP_LAYER (object);
|
||||
GimpLayer *layer = GIMP_LAYER (object);
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
|
|
|
@ -180,11 +180,7 @@ gimp_parasite_list_init (GimpParasiteList *list)
|
|||
static void
|
||||
gimp_parasite_list_finalize (GObject *object)
|
||||
{
|
||||
GimpParasiteList *list;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PARASITE_LIST (object));
|
||||
|
||||
list = GIMP_PARASITE_LIST (object);
|
||||
GimpParasiteList *list = GIMP_PARASITE_LIST (object);
|
||||
|
||||
if (list->table)
|
||||
{
|
||||
|
|
|
@ -261,6 +261,8 @@ file_save_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
typedef struct _OverwriteData OverwriteData;
|
||||
|
|
|
@ -261,6 +261,8 @@ file_save_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
typedef struct _OverwriteData OverwriteData;
|
||||
|
|
|
@ -101,6 +101,8 @@ gimp_text_layout_render (GimpTextLayout *layout,
|
|||
render_data);
|
||||
}
|
||||
while (pango_layout_iter_next_line (iter));
|
||||
|
||||
pango_layout_iter_free (iter);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -33,20 +33,19 @@
|
|||
|
||||
/* Prototypes */
|
||||
|
||||
static void gimp_stroke_class_init (GimpStrokeClass *klass);
|
||||
static void gimp_stroke_init (GimpStroke *stroke);
|
||||
static void gimp_stroke_class_init (GimpStrokeClass *klass);
|
||||
static void gimp_stroke_init (GimpStroke *stroke);
|
||||
static void gimp_stroke_finalize (GObject *object);
|
||||
|
||||
static void gimp_stroke_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_stroke_get_memsize (GimpObject *object,
|
||||
static gsize gimp_stroke_get_memsize (GimpObject *object,
|
||||
gsize *gui_size);
|
||||
|
||||
gdouble gimp_stroke_real_nearest_point_get (const GimpStroke *stroke,
|
||||
const GimpCoords *coord,
|
||||
const gdouble precision,
|
||||
GimpCoords *ret_point,
|
||||
GimpAnchor **ret_segment_start,
|
||||
gdouble *ret_pos);
|
||||
static gdouble gimp_stroke_real_nearest_point_get (const GimpStroke *stroke,
|
||||
const GimpCoords *coord,
|
||||
const gdouble precision,
|
||||
GimpCoords *ret_point,
|
||||
GimpAnchor **ret_segment_start,
|
||||
gdouble *ret_pos);
|
||||
static GimpAnchor * gimp_stroke_real_anchor_get (const GimpStroke *stroke,
|
||||
const GimpCoords *coord);
|
||||
static GimpAnchor * gimp_stroke_real_anchor_get_next (const GimpStroke *stroke,
|
||||
|
@ -250,16 +249,14 @@ gimp_stroke_init (GimpStroke *stroke)
|
|||
static void
|
||||
gimp_stroke_finalize (GObject *object)
|
||||
{
|
||||
GimpStroke *stroke;
|
||||
GList *list;
|
||||
GimpStroke *stroke = GIMP_STROKE (object);
|
||||
|
||||
stroke = GIMP_STROKE (object);
|
||||
|
||||
for (list = stroke->anchors; list; list = list->next)
|
||||
gimp_anchor_free (GIMP_ANCHOR (list->data));
|
||||
|
||||
g_list_free (stroke->anchors);
|
||||
stroke->anchors = NULL;
|
||||
if (stroke->anchors)
|
||||
{
|
||||
g_list_foreach (stroke->anchors, (GFunc) gimp_anchor_free, NULL);
|
||||
g_list_free (stroke->anchors);
|
||||
stroke->anchors = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -310,7 +307,7 @@ gimp_stroke_nearest_point_get (const GimpStroke *stroke,
|
|||
ret_pos);
|
||||
}
|
||||
|
||||
gdouble
|
||||
static gdouble
|
||||
gimp_stroke_real_nearest_point_get (const GimpStroke *stroke,
|
||||
const GimpCoords *coord,
|
||||
const gdouble precision,
|
||||
|
|
|
@ -244,13 +244,14 @@ gimp_vectors_init (GimpVectors *vectors)
|
|||
static void
|
||||
gimp_vectors_finalize (GObject *object)
|
||||
{
|
||||
GimpVectors *vectors;
|
||||
GimpVectors *vectors = GIMP_VECTORS (object);
|
||||
|
||||
vectors = GIMP_VECTORS (object);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: implement gimp_vectors_finalize()
|
||||
#endif
|
||||
if (vectors->strokes)
|
||||
{
|
||||
g_list_foreach (vectors->strokes, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (vectors->strokes);
|
||||
vectors->strokes = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
|
@ -276,7 +276,10 @@ gimp_font_selection_set_fontname (GimpFontSelection *fontsel,
|
|||
if (fontsel->font_desc)
|
||||
{
|
||||
if (pango_font_description_equal (fontsel->font_desc, new_desc))
|
||||
return;
|
||||
{
|
||||
pango_font_description_free (new_desc);
|
||||
return;
|
||||
}
|
||||
|
||||
pango_font_description_free (fontsel->font_desc);
|
||||
}
|
||||
|
|
|
@ -182,12 +182,12 @@ gimp_text_editor_new (const gchar *title,
|
|||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
|
||||
|
||||
|
||||
toolbar = GTK_TOOLBAR (gtk_toolbar_new ());
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox),
|
||||
GTK_WIDGET (toolbar), FALSE, FALSE, 0);
|
||||
gtk_widget_show (GTK_WIDGET (toolbar));
|
||||
|
||||
|
||||
gtk_toolbar_insert_stock (toolbar, GTK_STOCK_OPEN,
|
||||
_("Load Text from File"), NULL,
|
||||
G_CALLBACK (gimp_text_editor_load), editor,
|
||||
|
@ -210,21 +210,22 @@ gimp_text_editor_new (const gchar *title,
|
|||
GINT_TO_POINTER (editor->base_dir));
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (box));
|
||||
|
||||
|
||||
for (list = children; list; list = g_list_next (list))
|
||||
{
|
||||
button = GTK_WIDGET (list->data);
|
||||
|
||||
|
||||
g_object_ref (button);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (box), button);
|
||||
|
||||
gtk_toolbar_append_widget (toolbar, button, NULL, NULL);
|
||||
}
|
||||
|
||||
g_object_unref (button);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
gtk_widget_destroy (box);
|
||||
|
||||
gtk_object_sink (GTK_OBJECT (box));
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
|
@ -268,14 +269,14 @@ gimp_text_editor_set_direction (GimpTextEditor *editor,
|
|||
|
||||
g_signal_handlers_block_by_func (editor->group,
|
||||
G_CALLBACK (gimp_text_editor_dir_changed),
|
||||
editor);
|
||||
editor);
|
||||
|
||||
gimp_radio_group_set_active (GTK_RADIO_BUTTON (editor->group),
|
||||
GINT_TO_POINTER (base_dir));
|
||||
|
||||
g_signal_handlers_unblock_by_func (editor->group,
|
||||
G_CALLBACK (gimp_text_editor_dir_changed),
|
||||
editor);
|
||||
editor);
|
||||
|
||||
switch (editor->base_dir)
|
||||
{
|
||||
|
@ -295,7 +296,7 @@ gimp_text_editor_dir_changed (GtkWidget *widget,
|
|||
GimpTextEditor *editor)
|
||||
{
|
||||
GimpTextDirection dir;
|
||||
|
||||
|
||||
dir = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"gimp-item-data"));
|
||||
|
||||
|
@ -346,7 +347,7 @@ gimp_text_editor_load_ok (GimpTextEditor *editor)
|
|||
|
||||
filename =
|
||||
gtk_file_selection_get_filename (GTK_FILE_SELECTION (editor->filesel));
|
||||
|
||||
|
||||
if (gimp_text_editor_load_file (editor->buffer, filename))
|
||||
gtk_widget_destroy (editor->filesel);
|
||||
}
|
||||
|
@ -361,7 +362,7 @@ gimp_text_editor_load_file (GtkTextBuffer *buffer,
|
|||
GtkTextIter iter;
|
||||
|
||||
file = fopen (filename, "r");
|
||||
|
||||
|
||||
if (!file)
|
||||
{
|
||||
g_message (_("Error opening file '%s': %s"),
|
||||
|
|
Loading…
Reference in New Issue