scale_set_format_value_func causes 'Attempting to run a JS callback during shutdown / garbage collection'
Steps to reproduce
- Use this two scripts to test: settingsGtk4.js and SettingsGtk4.ui
- Run it via
gjs settingsGtk4.js
- Wait the window opened
- Close the window. You should see errors in the terminal.
$ gjs settingsGtk4.js
Gjs-Message: 11:10:49.566: JS LOG: Loading ui
Gjs-Message: 11:10:49.594: JS LOG: Loaded ui
Gjs-Message: 11:10:52.010: JS LOG: Shutting down...
Exit code: 0
(gjs:63897): Gjs-CRITICAL **: 11:10:52.013: Attempting to run a JS callback during garbage collection. This is most likely caused by destroying a Clutter actor or GTK widget with ::destroy signal connected, or using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked.
(gjs:63897): Gjs-CRITICAL **: 11:10:52.013: The offending callback was ScaleFormatValueFunc().
== Stack trace for context 0x5621ab793200 ==
(gjs:63897): Pango-WARNING **: 11:10:52.013: Invalid UTF-8 string passed to pango_layout_set_text()
fish: Job 1, 'gjs settingsGtk4.js' terminated by signal SIGSEGV (Address boundary error)
Version information
gtk4-4.4.1
Fedora 35
Warnings
Backtrace
Workaround
A workaround is unset format_value_func via scale.set_format_value_func(null) in the gtk.application shutdown signal method, see: https://github.com/nlpsuge/FrontendLearning/blob/7c96c92842dc0d0113cc2698e29c165ee19753ab/frontend-gnome-shell/frontend-gtk/src/load-glade-ui-tests/settingsGtk4.js#L88
And please also check:
Edited by nlpsuge