tools/pdbgen/pdb/procedural_db.pdb use regfree() to free the regex pattern

2003-02-18  Sven Neumann  <sven@gimp.org>

	* tools/pdbgen/pdb/procedural_db.pdb
	* app/pdb/procedural_db_cmds.c: use regfree() to free the regex
	pattern buffer.

	* app/widgets/gimpdnd.c (gimp_dnd_data_dest_add): unref the
	GtkTargetList after adding it to the widget.

	* app/core/gimpimage.c (gimp_image_get_new_preview): initialize
	all fields of the mask pixel_region.

	* app/core/gimpviewable.c (gimp_viewable_get_new_preview_pixbuf):
	pass a destroy notifier to gdk_pixbuf_new_from_data() so that the
	pixel data is freed with the pixbuf.

	* libgimptool/gimptool.c (gimp_tool_class_init): register a
	finalizer that unrefs the GimpToolControl object.

	* app/widgets/gimpenummenu.c (gimp_enum_stock_box_new_with_range):
	free the generated stock_id.
This commit is contained in:
Sven Neumann 2003-02-18 16:29:28 +00:00 committed by Sven Neumann
parent c2c23ebad0
commit a72799c53e
8 changed files with 75 additions and 23 deletions

View File

@ -1,3 +1,25 @@
2003-02-18 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/procedural_db.pdb
* app/pdb/procedural_db_cmds.c: use regfree() to free the regex
pattern buffer.
* app/widgets/gimpdnd.c (gimp_dnd_data_dest_add): unref the
GtkTargetList after adding it to the widget.
* app/core/gimpimage.c (gimp_image_get_new_preview): initialize
all fields of the mask pixel_region.
* app/core/gimpviewable.c (gimp_viewable_get_new_preview_pixbuf):
pass a destroy notifier to gdk_pixbuf_new_from_data() so that the
pixel data is freed with the pixbuf.
* libgimptool/gimptool.c (gimp_tool_class_init): register a
finalizer that unrefs the GimpToolControl object.
* app/widgets/gimpenummenu.c (gimp_enum_stock_box_new_with_range):
free the generated stock_id.
2003-02-18 Sven Neumann <sven@gimp.org>
* data/images/gimp_splash.png: flattened the splash image.

View File

@ -824,10 +824,10 @@ gimp_image_get_new_preview (GimpViewable *viewable,
g_assert (layer_buf->bytes <= comp->bytes);
src2PR.bytes = layer_buf->bytes;
src2PR.w = src1PR.w;
src2PR.h = src1PR.h;
src2PR.x = src1PR.x;
src2PR.y = src1PR.y;
src2PR.w = src1PR.w;
src2PR.h = src1PR.h;
src2PR.rowstride = layer_buf->width * src2PR.bytes;
src2PR.data = (temp_buf_data (layer_buf) +
(y1 - y) * src2PR.rowstride +
@ -838,7 +838,11 @@ gimp_image_get_new_preview (GimpViewable *viewable,
mask_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (layer->mask),
w, h);
maskPR.bytes = mask_buf->bytes;
maskPR.rowstride = mask_buf->width;
maskPR.x = src1PR.x;
maskPR.y = src1PR.y;
maskPR.w = src1PR.w;
maskPR.h = src1PR.h;
maskPR.rowstride = mask_buf->width * mask_buf->bytes;
maskPR.data = (mask_buf_data (mask_buf) +
(y1 - y) * maskPR.rowstride +
(x1 - x) * maskPR.bytes);

View File

@ -333,7 +333,8 @@ gimp_viewable_get_new_preview_pixbuf (GimpViewable *viewable,
width,
height,
width * bytes,
NULL, NULL);
(GdkPixbufDestroyNotify) g_free,
NULL);
if (color_buf)
temp_buf_free (color_buf);

View File

@ -383,13 +383,13 @@ procedural_db_query_invoker (Gimp *gimp,
g_hash_table_foreach (gimp->procedural_ht,
procedural_db_query_entry, &pdb_query);
free (pdb_query.name_regex.buffer);
free (pdb_query.blurb_regex.buffer);
free (pdb_query.help_regex.buffer);
free (pdb_query.author_regex.buffer);
free (pdb_query.copyright_regex.buffer);
free (pdb_query.date_regex.buffer);
free (pdb_query.proc_type_regex.buffer);
regfree (&pdb_query.name_regex);
regfree (&pdb_query.blurb_regex);
regfree (&pdb_query.help_regex);
regfree (&pdb_query.author_regex);
regfree (&pdb_query.copyright_regex);
regfree (&pdb_query.date_regex);
regfree (&pdb_query.proc_type_regex);
}
return_args = procedural_db_return_args (&procedural_db_query_proc, success);

View File

@ -655,13 +655,18 @@ gimp_dnd_data_dest_add (GimpDndType data_type,
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_add_table (target_list,
&dnd_data_defs[data_type].target_entry, 1);
{
gtk_target_list_add_table (target_list,
&dnd_data_defs[data_type].target_entry, 1);
}
else
target_list = gtk_target_list_new (&dnd_data_defs[data_type].target_entry,
1);
gtk_drag_dest_set_target_list (widget, target_list);
{
target_list = gtk_target_list_new (&dnd_data_defs[data_type].target_entry,
1);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
}
static void
@ -695,11 +700,7 @@ gimp_dnd_data_dest_remove (GimpDndType data_type,
TRUE);
if (atom != GDK_NONE)
{
gtk_target_list_remove (target_list, atom);
gtk_drag_dest_set_target_list (widget, target_list);
}
gtk_target_list_remove (target_list, atom);
}
}

View File

@ -597,8 +597,11 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
*first_button = button;
stock_id = g_strconcat (stock_prefix, "-", value->value_nick, NULL);
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
g_free (stock_id);
if (image)
{
gtk_container_add (GTK_CONTAINER (button), image);

View File

@ -40,6 +40,7 @@
static void gimp_tool_class_init (GimpToolClass *klass);
static void gimp_tool_init (GimpTool *tool);
static void gimp_tool_finalize (GObject *object);
static void gimp_tool_real_initialize (GimpTool *tool,
GimpDisplay *gdisp);
@ -115,8 +116,14 @@ gimp_tool_get_type (void)
static void
gimp_tool_class_init (GimpToolClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_tool_finalize;
klass->initialize = gimp_tool_real_initialize;
klass->control = gimp_tool_real_control;
klass->button_press = gimp_tool_real_button_press;
@ -138,6 +145,20 @@ gimp_tool_init (GimpTool *tool)
tool->drawable = NULL;
}
static void
gimp_tool_finalize (GObject *object)
{
GimpTool *tool = GIMP_TOOL (object);
if (tool->control)
{
g_object_unref (tool->control);
tool->control = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
void
gimp_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp)

View File

@ -160,7 +160,7 @@ HELP
$regcomp .= "regcomp (&pdb_query.${_}_regex, $_, 0);\n";
$free .= ' ' x 2 if $once++;
$free .= "free (pdb_query.${_}_regex.buffer);\n";
$free .= "regfree (&pdb_query.${_}_regex);\n";
}
chop $free;