2.99 ScriptFu: plugin Image>Guides>New.. and others crash extension-script-fu
Environment/Versions
- GIMP version: overnight
- Package: self-build
- Operating System: Linux
Description of the bug
Certain plugins (that call script-fu-register-filter and thus served by extension-script-fu but use GimpProcedureDialog instead of the home-built GUI rolled by SF) crash extension-script-fu when they are the first plugins called. If you call an old-style SF plugin first, then extension-script-fu doesn't crash (since it long-lived and has already called gimp_ui_init.)
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Start gimp
- File>New
- Image>Guides>New... …
Expected result: dialog appears
Actual result: In console:
(script-fu:337): scriptfu-DEBUG: 15:57:46.585: script_fu_run_image_procedure
option GParamInt
adjustment GParamInt
(script-fu:337): scriptfu-DEBUG: 15:57:46.585: Len of initial_args 2
(script-fu:337): LibGimpUI-WARNING **: 15:57:46.586: gimp_procedure_dialog_constructor: no default screen. Did you call gimp_ui_init()?
(script-fu:337): Gtk-CRITICAL **: 15:57:46.586: _gtk_css_lookup_resolve: assertion '(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ((provider)); GType __t = ((_gtk_style_provider_private_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))' failed
Terminating plug-in: '/usr/local/lib/x86_64-linux-gnu/gimp/2.99/plug-ins/script-fu/script-fu'
and since extension-script-fu has crashed, menu items served by it are gone from the Gimp GUI.
Additional information
The cause is failing to call gimp_ui_init at the right time, before showing GUI.
Another test case is Filters>Dev>SF>Test>Clothify v3...
By way of forensics, Clothify v3... has existed a long time, but I suppose never tested as the first plugin to be called. Recently, more plugins (including Guides>New) have been ported to call script-fu-register-filter (but not ported to be independently interpreted), so more chance that one was the first plugin served by extension-script-fu.