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

Bug 552413 – Script triggers Gimp-Core-CRITICAL

2008-09-15  Michael Natterer  <mitch@gimp.org>

	Bug 552413 – Script triggers Gimp-Core-CRITICAL

	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/layer.pdb: add some more checks that produce
	proper PDB error messages when adding and removing layer masks
	instead of having the code run into assertions in the called core
	functions. Also add some more checks when removing layers,
	channels or vectors.

	* app/pdb/image-cmds.c
	* app/pdb/layer-cmds.c: regenerated.


svn path=/trunk/; revision=26947
parent 4ecffa67
2008-09-15 Michael Natterer <mitch@gimp.org>
Bug 552413 – Script triggers Gimp-Core-CRITICAL
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb: add some more checks that produce
proper PDB error messages when adding and removing layer masks
instead of having the code run into assertions in the called core
functions. Also add some more checks when removing layers,
channels or vectors.
* app/pdb/image-cmds.c
* app/pdb/layer-cmds.c: regenerated.
2008-09-14 Kevin Cozens <kcozens@cvs.gnome.org>
* plug-ins/script-fu/tinyscheme/scheme.c (mk_vector), (opexe_2):
......
......@@ -897,7 +897,10 @@ image_remove_layer_invoker (GimpProcedure *procedure,
if (success)
{
gimp_image_remove_layer (image, layer);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
gimp_image_remove_layer (image, layer);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
......@@ -1084,7 +1087,10 @@ image_remove_channel_invoker (GimpProcedure *procedure,
if (success)
{
gimp_image_remove_channel (image, channel);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
gimp_image_remove_channel (image, channel);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
......@@ -1223,7 +1229,10 @@ image_remove_vectors_invoker (GimpProcedure *procedure,
if (success)
{
gimp_image_remove_vectors (image, vectors);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
gimp_image_remove_vectors (image, vectors);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
......@@ -1481,7 +1490,10 @@ image_add_layer_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_layer_add_mask (layer, mask, TRUE))
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
! gimp_layer_get_mask (layer))
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
else
success = FALSE;
}
......@@ -1508,7 +1520,11 @@ image_remove_layer_mask_invoker (GimpProcedure *procedure,
if (success)
{
gimp_layer_apply_mask (layer, mode, TRUE);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success,
......
......@@ -550,8 +550,9 @@ layer_add_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
gimp_layer_add_mask (layer, mask, TRUE);
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
! gimp_layer_get_mask (layer))
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
else
success = FALSE;
}
......@@ -577,7 +578,8 @@ layer_remove_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else
success = FALSE;
......
......@@ -991,7 +991,10 @@ HELP
%invoke = (
code => <<'CODE'
{
gimp_image_remove_layer (image, layer);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
gimp_image_remove_layer (image, layer);
else
success = FALSE;
}
CODE
);
......@@ -1012,7 +1015,10 @@ sub image_add_layer_mask {
%invoke = (
code => <<'CODE'
{
if (! gimp_layer_add_mask (layer, mask, TRUE))
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
! gimp_layer_get_mask (layer))
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
else
success = FALSE;
}
CODE
......@@ -1034,7 +1040,11 @@ sub image_remove_layer_mask {
%invoke = (
code => <<'CODE'
{
gimp_layer_apply_mask (layer, mode, TRUE);
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else
success = FALSE;
}
CODE
);
......@@ -1185,7 +1195,10 @@ HELP
%invoke = (
code => <<'CODE'
{
gimp_image_remove_channel (image, channel);
if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
gimp_image_remove_channel (image, channel);
else
success = FALSE;
}
CODE
);
......@@ -1245,7 +1258,10 @@ HELP
%invoke = (
code => <<'CODE'
{
gimp_image_remove_vectors (image, vectors);
if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
gimp_image_remove_vectors (image, vectors);
else
success = FALSE;
}
CODE
);
......
......@@ -276,8 +276,9 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
gimp_layer_add_mask (layer, mask, TRUE);
if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
! gimp_layer_get_mask (layer))
success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
else
success = FALSE;
}
......@@ -305,7 +306,8 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error) &&
gimp_layer_get_mask (layer))
gimp_layer_apply_mask (layer, mode, TRUE);
else
success = FALSE;
......
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