app: do not assume procedures always have a run mode.
This is especially true since procedures are defined by plug-ins, possibly third-party. So they may not have a first run mode parameter. Also we don't want plug-ins to generate CRITICALs in the core application. Therefore before trying to get and/or set the run mode parameter, always check that this first parameter exists, and if so, is it a GimpRunMode enum? Fixes similar errors: > GIMP-CRITICAL: gimp_value_array_index: assertion 'index < value_array->n_values' failed Moreover it also makes sense to allow plug-ins to not have such parameter. What if you make a plug-in which always work in a single mode and don't ever plan/want to make it work interactively for instance? Lastly old Python 2 plug-ins didn't even have a run mode parameter (I guess our old Python 2 wrapper was getting rid of it?).
Showing with 46 additions and 21 deletions