operations: Guard against missing config in...
...GimpCageCoefficientCalculation. Resolves #8297 The custom filter "gimp:cage-coef-calc" is used in the Cage Transform tool, which always sends in a GimpCageConfig parameter. However, it's possible to call this filter from GEGL Graph without the config. This causes GIMP to crash, as it tries to access members of a non-existent config in gimp_cage_config_get_n_points (). This patch adds safeguard checks to make sure there's a config object before trying to use it. The resulting filter's output in these cases is blank, which is not ideal but better than a crash.
This commit is contained in:
parent
1376d25453
commit
daea3c2298
1 changed files with 9 additions and 2 deletions
|
|
@ -172,6 +172,9 @@ gimp_operation_cage_coef_calc_prepare (GeglOperation *operation)
|
|||
GimpOperationCageCoefCalc *occc = GIMP_OPERATION_CAGE_COEF_CALC (operation);
|
||||
GimpCageConfig *config = GIMP_CAGE_CONFIG (occc->config);
|
||||
|
||||
if (! config)
|
||||
return;
|
||||
|
||||
gegl_operation_set_format (operation,
|
||||
"output",
|
||||
babl_format_n (babl_type ("float"),
|
||||
|
|
@ -183,8 +186,12 @@ gimp_operation_cage_coef_calc_get_bounding_box (GeglOperation *operation)
|
|||
{
|
||||
GimpOperationCageCoefCalc *occc = GIMP_OPERATION_CAGE_COEF_CALC (operation);
|
||||
GimpCageConfig *config = GIMP_CAGE_CONFIG (occc->config);
|
||||
GeglRectangle rect = {};
|
||||
|
||||
return gimp_cage_config_get_bounding_box (config);
|
||||
if (config)
|
||||
return gimp_cage_config_get_bounding_box (config);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -207,7 +214,7 @@ gimp_operation_cage_coef_calc_process (GeglOperation *operation,
|
|||
|
||||
format = babl_format_n (babl_type ("float"), 2 * gimp_cage_config_get_n_points (config));
|
||||
|
||||
n_cage_vertices = gimp_cage_config_get_n_points (config);
|
||||
n_cage_vertices = gimp_cage_config_get_n_points (config);
|
||||
|
||||
it = gegl_buffer_iterator_new (output, roi, 0, format,
|
||||
GEGL_ACCESS_WRITE, GEGL_ABYSS_NONE, 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue