Commit f4e1ec97 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Refcount layer masks correctly. Fixes layer mask undo.

2002-09-01  Michael Natterer  <mitch@gimp.org>

	Refcount layer masks correctly. Fixes layer mask undo.

	* app/core/gimplayer.c (gimp_layer_add_mask): ref the mask.

	* app/xcf/xcf-load.c
	* app/gui/layers-commands.c
	* tools/pdbgen/pdb/image.pdb: unref layer masks after adding them.

	* app/pdb/image_cmds.c: regenerated.
parent 47f91a51
2002-09-01 Michael Natterer <mitch@gimp.org>
Refcount layer masks correctly. Fixes layer mask undo.
* app/core/gimplayer.c (gimp_layer_add_mask): ref the mask.
* app/xcf/xcf-load.c
* app/gui/layers-commands.c
* tools/pdbgen/pdb/image.pdb: unref layer masks after adding them.
* app/pdb/image_cmds.c: regenerated.
2002-08-30 Michael Natterer <mitch@gimp.org> 2002-08-30 Michael Natterer <mitch@gimp.org>
* app/widgets/Makefile.am * app/widgets/Makefile.am
......
...@@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage, ...@@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Layer"), "new_layer_options", _("New Layer"), "new_layer_options",
GTK_STOCK_NEW, GTK_STOCK_NEW,
_("New Layer Options"), _("Create a New Layer"),
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/layers/new_layer.html", "dialogs/layers/new_layer.html",
...@@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget, ...@@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget,
{ {
mask = gimp_layer_create_mask (layer, options->add_mask_type); mask = gimp_layer_create_mask (layer, options->add_mask_type);
gimp_layer_add_mask (layer, mask, TRUE); gimp_layer_add_mask (layer, mask, TRUE);
g_object_unref (G_OBJECT (mask));
gimp_image_flush (gimage); gimp_image_flush (gimage);
} }
...@@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer) ...@@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer)
/* The dialog */ /* The dialog */
options->query_box = options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Add Mask"), "add_mask_options", _("Add Layer Mask"), "add_mask_options",
GTK_STOCK_ADD, GTK_STOCK_ADD,
_("Add Layer Mask Options"), _("Add a Mask to the Layer"),
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/layers/add_layer_mask.html", "dialogs/layers/add_layer_mask.html",
......
...@@ -589,6 +589,7 @@ gimp_layer_add_mask (GimpLayer *layer, ...@@ -589,6 +589,7 @@ gimp_layer_add_mask (GimpLayer *layer,
} }
layer->mask = mask; layer->mask = mask;
g_object_ref (G_OBJECT (layer->mask));
gimp_layer_mask_set_layer (mask, layer); gimp_layer_mask_set_layer (mask, layer);
......
...@@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage, ...@@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Layer"), "new_layer_options", _("New Layer"), "new_layer_options",
GTK_STOCK_NEW, GTK_STOCK_NEW,
_("New Layer Options"), _("Create a New Layer"),
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/layers/new_layer.html", "dialogs/layers/new_layer.html",
...@@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget, ...@@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget,
{ {
mask = gimp_layer_create_mask (layer, options->add_mask_type); mask = gimp_layer_create_mask (layer, options->add_mask_type);
gimp_layer_add_mask (layer, mask, TRUE); gimp_layer_add_mask (layer, mask, TRUE);
g_object_unref (G_OBJECT (mask));
gimp_image_flush (gimage); gimp_image_flush (gimage);
} }
...@@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer) ...@@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer)
/* The dialog */ /* The dialog */
options->query_box = options->query_box =
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Add Mask"), "add_mask_options", _("Add Layer Mask"), "add_mask_options",
GTK_STOCK_ADD, GTK_STOCK_ADD,
_("Add Layer Mask Options"), _("Add a Mask to the Layer"),
gimp_standard_help_func, gimp_standard_help_func,
"dialogs/layers/add_layer_mask.html", "dialogs/layers/add_layer_mask.html",
......
...@@ -1605,7 +1605,12 @@ image_add_layer_mask_invoker (Gimp *gimp, ...@@ -1605,7 +1605,12 @@ image_add_layer_mask_invoker (Gimp *gimp,
success = FALSE; success = FALSE;
if (success) if (success)
success = gimp_layer_add_mask (layer, mask, TRUE) != NULL; {
success = gimp_layer_add_mask (layer, mask, TRUE) != NULL;
if (success)
g_object_unref (G_OBJECT (mask));
}
return procedural_db_return_args (&image_add_layer_mask_proc, success); return procedural_db_return_args (&image_add_layer_mask_proc, success);
} }
......
...@@ -903,6 +903,7 @@ xcf_load_layer (XcfInfo *info, ...@@ -903,6 +903,7 @@ xcf_load_layer (XcfInfo *info,
GIMP_DRAWABLE (layer_mask)->offset_y = GIMP_DRAWABLE (layer)->offset_y; GIMP_DRAWABLE (layer_mask)->offset_y = GIMP_DRAWABLE (layer)->offset_y;
gimp_layer_add_mask (layer, layer_mask, FALSE); gimp_layer_add_mask (layer, layer_mask, FALSE);
g_object_unref (G_OBJECT (layer));
layer->mask->apply_mask = apply_mask; layer->mask->apply_mask = apply_mask;
layer->mask->edit_mask = edit_mask; layer->mask->edit_mask = edit_mask;
......
...@@ -677,7 +677,12 @@ HELP ...@@ -677,7 +677,12 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
success = gimp_layer_add_mask (layer, mask, TRUE) != NULL; {
success = gimp_layer_add_mask (layer, mask, TRUE) != NULL;
if (success)
g_object_unref (G_OBJECT (mask));
}
CODE CODE
); );
} }
......
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