libgimp: some debug printing for plug-in developers.

This will be useful for plug-in developers but also for us. Seeing we leak the
config object is often a good indication that something is wrong in our handling
of internal references (since everything relies on the config object in plug-ins
now, in particular all the GUI).
This commit is contained in:
Jehan 2023-07-17 23:31:26 +02:00
parent e6e3545959
commit fc9a720b31
2 changed files with 16 additions and 0 deletions

View File

@ -188,6 +188,14 @@ gimp_image_procedure_run (GimpProcedure *procedure,
status = GIMP_VALUES_GET_ENUM (return_values, 0);
gimp_procedure_config_end_run (config, status);
/* This is debug printing to help plug-in developers figure out best
* practices.
*/
if (G_OBJECT (config)->ref_count > 1)
g_printerr ("%s: ERROR: the GimpProcedureConfig object was refed "
"by plug-in, it MUST NOT do that!\n", G_STRFUNC);
g_object_unref (config);
}
else

View File

@ -507,6 +507,14 @@ gimp_procedure_real_run (GimpProcedure *procedure,
status = GIMP_VALUES_GET_ENUM (retvals, 0);
gimp_procedure_config_end_run (config, status);
/* This is debug printing to help plug-in developers figure out best
* practices.
*/
if (G_OBJECT (config)->ref_count > 1)
g_printerr ("%s: ERROR: the GimpProcedureConfig object was refed "
"by plug-in, it MUST NOT do that!\n", G_STRFUNC);
g_object_unref (config);
return retvals;