How to get the default GTK settings on Linux 64 bit

Popular CustomEditField uses this code on Linux to determine the delay for detecting a double click:

Declare Function gtk_settings_get_default lib "" as Ptr dim gtkSettings as Ptr = gtk_settings_get_default()

Unfortunately, that crashes on my Fedora v32 system in 64 bit, inside gtk_settings_get_for_screen()

This suggests that while the gtk_settings_get_default gets actually called, it then invokes gtk_settings_get_for_screen, as it’s documented, but the screen can’t be determined, leading to the segfault.

This code is called in a Canvas.MouseUp event of a visible window, so the screen of the current window should be determinable.

I am pretty sure this used to work in 32 bit builds.

Does someone know how to make this work?

Found the issue: I need to use “libgtk-3” as the lib name now. So, even though IsFunctionAvailable ("gtk_settings_get_default", "") returned true, it still would crash when calling it.

Can’t tell if this is a bug in Xojo that needs fixing. I think it should because the IsFunctionAvailable is explicitly meant to make sure the app is NOT crashing when trying to use soft declares (which I did in a test)

Not in Xojo - the function changed between the two versions of GTK.