-
Jehan authored
This is a continuation of #5888 as I realized that most layer modes were fixed with my commit b3fc2426 (and follow-up f40dc40c) but at least 2 were still crashing GIMP: "Luma Lighten/Darken only" modes. There were 2 bugs here: * The first bug was that when gimp_operation_layer_mode_real_process() ran, gimp_operation_layer_mode_prepare() had not been run yet. prepare() is called before the process() of GeglOperation, but it would seem the process() of GimpOperationLayerMode on the other end happens before GeglOperation's prepare() is run. I am absolutely unsure if this is expected or not and have a hard time figuring out all the details of the C/C++ cohabitation. As a solution, I am moving out the fish caching (the needed part inside gimp_operation_layer_mode_real_process()) in its own function so that I can easily call it separately before inspecting the fishes. * The second issue was that some blend functions needed more than a GeglOperation alone. E.g. blend_function() for luma lighten gimp_operation_layer_mode_blend_luma_lighten_only() would call gegl_operation_get_source_space() which requires the node to exist. Similarly for the Luma darken only mode. So I keep both the node and operation around, and when finalizing, I free the node (which in turn frees the operation). Ell > if you are reading our commits, I would really appreciate your review (or fixes) of my code here! :)
75e6f106