From f4e1ec9734db98e9dea6fcfccdade17d38f9ca26 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 1 Sep 2002 07:25:41 +0000 Subject: [PATCH] Refcount layer masks correctly. Fixes layer mask undo. 2002-09-01 Michael Natterer 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. --- ChangeLog | 12 ++++++++++++ app/actions/layers-commands.c | 8 +++++--- app/core/gimplayer.c | 1 + app/gui/layers-commands.c | 8 +++++--- app/pdb/image_cmds.c | 7 ++++++- app/xcf/xcf-load.c | 1 + tools/pdbgen/pdb/image.pdb | 7 ++++++- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 144e958e7c..d2352b0ea0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-09-01 Michael Natterer + + 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 * app/widgets/Makefile.am diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index 9c2d2f85ea..8ae0b31f24 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage, gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), _("New Layer"), "new_layer_options", GTK_STOCK_NEW, - _("New Layer Options"), + _("Create a New Layer"), gimp_standard_help_func, "dialogs/layers/new_layer.html", @@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget, { mask = gimp_layer_create_mask (layer, options->add_mask_type); gimp_layer_add_mask (layer, mask, TRUE); + g_object_unref (G_OBJECT (mask)); + gimp_image_flush (gimage); } @@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer) /* The dialog */ options->query_box = gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), - _("Add Mask"), "add_mask_options", + _("Add Layer Mask"), "add_mask_options", GTK_STOCK_ADD, - _("Add Layer Mask Options"), + _("Add a Mask to the Layer"), gimp_standard_help_func, "dialogs/layers/add_layer_mask.html", diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index fcc245c3bb..90e0643cac 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -589,6 +589,7 @@ gimp_layer_add_mask (GimpLayer *layer, } layer->mask = mask; + g_object_ref (G_OBJECT (layer->mask)); gimp_layer_mask_set_layer (mask, layer); diff --git a/app/gui/layers-commands.c b/app/gui/layers-commands.c index 9c2d2f85ea..8ae0b31f24 100644 --- a/app/gui/layers-commands.c +++ b/app/gui/layers-commands.c @@ -581,7 +581,7 @@ layers_new_layer_query (GimpImage *gimage, gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage), _("New Layer"), "new_layer_options", GTK_STOCK_NEW, - _("New Layer Options"), + _("Create a New Layer"), gimp_standard_help_func, "dialogs/layers/new_layer.html", @@ -853,6 +853,8 @@ add_mask_query_ok_callback (GtkWidget *widget, { mask = gimp_layer_create_mask (layer, options->add_mask_type); gimp_layer_add_mask (layer, mask, TRUE); + g_object_unref (G_OBJECT (mask)); + gimp_image_flush (gimage); } @@ -876,9 +878,9 @@ layers_add_mask_query (GimpLayer *layer) /* The dialog */ options->query_box = gimp_viewable_dialog_new (GIMP_VIEWABLE (layer), - _("Add Mask"), "add_mask_options", + _("Add Layer Mask"), "add_mask_options", GTK_STOCK_ADD, - _("Add Layer Mask Options"), + _("Add a Mask to the Layer"), gimp_standard_help_func, "dialogs/layers/add_layer_mask.html", diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index 52f467ae01..693daf949d 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -1605,7 +1605,12 @@ image_add_layer_mask_invoker (Gimp *gimp, success = FALSE; 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); } diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 8d19d40773..f2b7cf82c6 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -903,6 +903,7 @@ xcf_load_layer (XcfInfo *info, GIMP_DRAWABLE (layer_mask)->offset_y = GIMP_DRAWABLE (layer)->offset_y; gimp_layer_add_mask (layer, layer_mask, FALSE); + g_object_unref (G_OBJECT (layer)); layer->mask->apply_mask = apply_mask; layer->mask->edit_mask = edit_mask; diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index dcc05968e5..4c310bd919 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -677,7 +677,12 @@ HELP %invoke = ( 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 ); } -- GitLab