Commit 39368a41 authored by Massimo Valentini's avatar Massimo Valentini
Browse files

plugged memory leaks

parent 73a3b56e
......@@ -357,6 +357,7 @@ windows_actions_update_display_accels (GimpActionGroup *group)
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
g_free (action_name);
if (action)
{
......
......@@ -2285,6 +2285,7 @@ select_colors_rgb (QuantizeObj *quantobj,
{
compute_color_rgb (quantobj, histogram, &boxlist[i], i);
}
g_free (boxlist);
}
......
......@@ -419,6 +419,7 @@ gimp_image_merge_layers (GimpImage *image,
{
GList *list;
GSList *reverse_list = NULL;
GSList *layers;
PixelRegion src1PR, src2PR, maskPR;
PixelRegion *mask;
GimpLayer *merge_layer;
......@@ -600,14 +601,14 @@ gimp_image_merge_layers (GimpImage *image,
gimp_item_set_parasites (GIMP_ITEM (merge_layer), parasites);
g_object_unref (parasites);
while (reverse_list)
for (layers = reverse_list; layers; layers = g_slist_next (layers))
{
CombinationMode operation;
GimpLayerModeEffects mode;
gint x3, y3, x4, y4;
gboolean active[MAX_CHANNELS] = { TRUE, TRUE, TRUE, TRUE };
layer = reverse_list->data;
layer = layers->data;
/* determine what sort of operation is being attempted and
* if it's actually legal...
......@@ -679,8 +680,6 @@ gimp_image_merge_layers (GimpImage *image,
operation);
gimp_image_remove_layer (image, layer, TRUE, NULL);
reverse_list = g_slist_next (reverse_list);
}
g_slist_free (reverse_list);
......
......@@ -121,6 +121,8 @@ gimp_item_toggle_exclusive_visible (GimpItem *item,
g_list_free (on);
g_list_free (off);
}
g_list_free (ancestry);
}
......
......@@ -236,6 +236,12 @@ gimp_stroke_options_finalize (GObject *object)
{
GimpStrokeOptionsPrivate *private = GET_PRIVATE (object);
if (private->dash_info)
{
gimp_dash_pattern_free (private->dash_info);
private->dash_info = NULL;
}
if (private->paint_options)
{
g_object_unref (private->paint_options);
......
......@@ -87,11 +87,11 @@ static void about_dialog_add_message (GtkWidget *vbox);
GtkWidget *
about_dialog_create (GimpContext *context)
{
static GimpAboutDialog *dialog = NULL;
static GimpAboutDialog dialog;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! dialog)
if (! dialog.dialog)
{
GtkWidget *widget;
GtkWidget *container;
......@@ -99,9 +99,7 @@ about_dialog_create (GimpContext *context)
GList *children;
gchar *copyright;
dialog = g_new0 (GimpAboutDialog, 1);
dialog->n_authors = G_N_ELEMENTS (authors) - 1;
dialog.n_authors = G_N_ELEMENTS (authors) - 1;
pixbuf = about_dialog_load_logo ();
......@@ -133,9 +131,9 @@ about_dialog_create (GimpContext *context)
g_free (copyright);
dialog->dialog = widget;
dialog.dialog = widget;
g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog);
g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog.dialog);
g_signal_connect (widget, "response",
G_CALLBACK (gtk_widget_destroy),
......@@ -143,10 +141,10 @@ about_dialog_create (GimpContext *context)
g_signal_connect (widget, "map",
G_CALLBACK (about_dialog_map),
dialog);
&dialog);
g_signal_connect (widget, "unmap",
G_CALLBACK (about_dialog_unmap),
dialog);
&dialog);
/* kids, don't try this at home! */
container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
......@@ -154,7 +152,7 @@ about_dialog_create (GimpContext *context)
if (GTK_IS_BOX (children->data))
{
about_dialog_add_animation (children->data, dialog);
about_dialog_add_animation (children->data, &dialog);
about_dialog_add_message (children->data);
}
else
......@@ -163,9 +161,9 @@ about_dialog_create (GimpContext *context)
g_list_free (children);
}
gtk_window_present (GTK_WINDOW (dialog->dialog));
gtk_window_present (GTK_WINDOW (dialog.dialog));
return dialog->dialog;
return dialog.dialog;
}
static void
......
......@@ -473,6 +473,7 @@ dialog_info_update (GimpModuleDB *db,
for (i = 0; i < N_INFOS; i++)
gtk_label_set_text (GTK_LABEL (dialog->label[i]),
text[i] ? text[i] : "--");
g_free (location);
/* Show errors */
show_error = (module->state == GIMP_MODULE_STATE_ERROR &&
......
......@@ -337,7 +337,7 @@ gimp_canvas_polygon_new_from_coords (GimpDisplayShell *shell,
}
array = gimp_array_new ((const guint8 *) points,
n_coords * sizeof (GimpVector2), FALSE);
n_coords * sizeof (GimpVector2), TRUE);
item = g_object_new (GIMP_TYPE_CANVAS_POLYGON,
"shell", shell,
......@@ -346,6 +346,7 @@ gimp_canvas_polygon_new_from_coords (GimpDisplayShell *shell,
NULL);
gimp_array_free (array);
g_free (points);
return item;
}
......@@ -41,7 +41,7 @@ void
gimp_display_shell_expose_region (GimpDisplayShell *shell,
cairo_region_t *region)
{
GdkRegion *gdk_region = gdk_region_new ();
GdkRegion *gdk_region;
gint n_rectangles;
gint i;
......@@ -51,6 +51,7 @@ gimp_display_shell_expose_region (GimpDisplayShell *shell,
if (! gtk_widget_get_realized (shell->canvas))
return;
gdk_region = gdk_region_new ();
n_rectangles = cairo_region_num_rectangles (region);
for (i = 0; i < n_rectangles; i++)
......
......@@ -265,6 +265,7 @@ gimp_ui_configurer_move_docks_to_columns (GimpUIConfigurer *ui_configurer,
g_list_free (docks);
}
}
g_list_free (dialogs);
}
/**
......
......@@ -178,6 +178,12 @@ gimp_paint_core_finalize (GObject *object)
g_free (core->undo_desc);
core->undo_desc = NULL;
if (core->stroke_buffer)
{
g_array_free (core->stroke_buffer, TRUE);
core->stroke_buffer = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -764,6 +764,7 @@ gimp_procedure_validate_args (GimpProcedure *procedure,
}
}
g_value_unset (&string_value);
return FALSE;
}
......
......@@ -695,6 +695,7 @@ vectors_stroke_new_from_points_invoker (GimpProcedure *procedure,
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
......@@ -817,6 +818,7 @@ vectors_bezier_stroke_new_moveto_invoker (GimpProcedure *procedure,
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
}
......@@ -1036,6 +1038,7 @@ vectors_bezier_stroke_new_ellipse_invoker (GimpProcedure *procedure,
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
}
......
......@@ -22,6 +22,7 @@
#include <gegl.h>
#include "libgimpbase/gimpbase.h"
#include "text-types.h"
#include "core/gimp.h"
......@@ -125,6 +126,8 @@ gimp_text_layer_xcf_save_prepare (GimpTextLayer *layer)
* while the text layer is saved to XCF.
*/
gimp_item_parasite_attach (GIMP_ITEM (layer), parasite, FALSE);
gimp_parasite_free (parasite);
}
}
......
......@@ -550,6 +550,7 @@ gimp_text_layout_set_markup (GimpTextLayout *layout)
g_free (close_tag);
pango_layout_set_markup (layout->layout, markup, -1);
g_free (markup);
}
static void
......
......@@ -1049,7 +1049,7 @@ gimp_draw_tool_on_vectors_handle (GimpDrawTool *draw_tool,
while ((stroke = gimp_vectors_stroke_get_next (vectors, stroke)))
{
GList *anchor_list = gimp_stroke_get_draw_anchors (stroke);
GList *anchor_list;
GList *list;
anchor_list = g_list_concat (gimp_stroke_get_draw_anchors (stroke),
......
......@@ -341,6 +341,7 @@ gimp_vector_tool_button_press (GimpTool *tool,
vector_tool->cur_stroke = gimp_bezier_stroke_new ();
gimp_vectors_stroke_add (vector_tool->vectors, vector_tool->cur_stroke);
g_object_unref (vector_tool->cur_stroke);
vector_tool->undo_motion = TRUE;
......@@ -610,7 +611,6 @@ gimp_vector_tool_button_press (GimpTool *tool,
/* deleting a segment (opening up a stroke) */
if (vector_tool->function == VECTORS_DELETE_SEGMENT &&
gimp_vector_tool_check_writable (vector_tool))
{
......@@ -621,7 +621,10 @@ gimp_vector_tool_button_press (GimpTool *tool,
new_stroke = gimp_stroke_open (vector_tool->cur_stroke,
vector_tool->cur_anchor);
if (new_stroke)
gimp_vectors_stroke_add (vector_tool->vectors, new_stroke);
{
gimp_vectors_stroke_add (vector_tool->vectors, new_stroke);
g_object_unref (new_stroke);
}
vector_tool->undo_motion = TRUE;
vector_tool->cur_stroke = NULL;
......@@ -1881,6 +1884,7 @@ gimp_vector_tool_verify_state (GimpVectorTool *vector_tool)
}
}
g_list_free (anchors);
anchors = gimp_stroke_get_draw_controls (cur_stroke);
for (list = anchors; list; list = g_list_next (list))
......@@ -1890,6 +1894,8 @@ gimp_vector_tool_verify_state (GimpVectorTool *vector_tool)
if (cur_anchor == vector_tool->cur_anchor)
cur_anchor_valid = TRUE;
}
g_list_free (anchors);
}
if (! cur_stroke_valid)
......
......@@ -356,7 +356,7 @@ gimp_vectors_import (GimpImage *image,
if (! merge)
gimp_vectors_thaw (vectors);
g_list_free (path->strokes);
g_list_free_full (path->strokes, g_object_unref);
path->strokes = NULL;
}
......
......@@ -1170,8 +1170,8 @@ gimp_vectors_real_make_bezier (const GimpVectors *vectors)
{
ret_bezdesc = gimp_bezier_desc_new ((cairo_path_data_t *) cmd_array->data,
cmd_array->len);
g_array_free (cmd_array, FALSE);
}
g_array_free (cmd_array, FALSE);
return ret_bezdesc;
}
......@@ -313,6 +313,8 @@ gimp_controller_list_init (GimpControllerList *list)
gtk_widget_set_sensitive (list->edit_button, FALSE);
gtk_widget_set_sensitive (list->up_button, FALSE);
gtk_widget_set_sensitive (list->down_button, FALSE);
g_free (controller_types);
}
static void
......
......@@ -487,6 +487,7 @@ gimp_device_info_editor_constructed (GObject *object)
label = gtk_label_new (string);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (label);
g_free (string);
}
}
}
......
......@@ -875,6 +875,7 @@ gimp_tag_entry_parse_tags (GimpTagEntry *entry)
}
parsed_tags[length] = NULL;
g_list_free (tag_list);
return parsed_tags;
}
......
......@@ -236,6 +236,7 @@ gimp_text_buffer_serialize (GtkTextBuffer *register_buffer,
}
while (! gtk_text_iter_equal (&iter, end));
g_slist_free (tag_list);
/* Close any open tags */
for (tag_list = active_tags; tag_list; tag_list = tag_list->next)
close_tag (GIMP_TEXT_BUFFER (register_buffer), string, tag_list->data);
......
......@@ -424,6 +424,7 @@ gimp_text_style_editor_finalize (GObject *object)
editor->fonts = NULL;
}
g_list_free (editor->toggles);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -241,6 +241,8 @@ xcf_load_image (Gimp *gimp,
NULL));
container = gimp_viewable_get_children (GIMP_VIEWABLE (parent));
g_list_free (item_path);
}
else
{
......@@ -1727,7 +1729,10 @@ xcf_load_old_path (XcfInfo *info,
/* skip empty compatibility paths */
if (num_points == 0)
return FALSE;
{
g_free (name);
return FALSE;
}
points = g_new0 (GimpVectorsCompatPoint, num_points);
......@@ -1856,6 +1861,7 @@ xcf_load_vector (XcfInfo *info,
#endif
vectors = gimp_vectors_new (image, name);
g_free (name);
gimp_item_set_visible (GIMP_ITEM (vectors), visible, FALSE);
gimp_item_set_linked (GIMP_ITEM (vectors), linked, FALSE);
......@@ -1957,6 +1963,9 @@ xcf_load_vector (XcfInfo *info,
NULL);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
g_value_array_free (control_points);
}
gimp_image_add_vectors (image, vectors,
......
......@@ -333,6 +333,7 @@ gimp_number_pair_entry_finalize (GObject *object)
priv->num_separators = 0;
}
g_free (priv->default_text);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -741,6 +741,7 @@ HELP
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
......@@ -797,6 +798,7 @@ HELP
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
}
......@@ -1021,6 +1023,7 @@ HELP
vectors);
gimp_vectors_stroke_add (vectors, stroke);
g_object_unref (stroke);
stroke_id = gimp_stroke_get_ID (stroke);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment