gnutls: Fix a crash caused by loading and unloading the module
gnutls: Fix a crash caused by loading and unloading the module

If gio-querymodules isn't run to update the cache then gio will need
to load and unload the module at startup time. This was causing
crashes in apps that used gcrypt elsewhere, because gcrypt was being
initialized to use our module's mutex functions, which then no longer
existed after unloading.

Fix this in two different ways: first, force the module to remain
resident after gtls_gnutls_init() has been called, and second, don't
call gtls_gnutls_init() if we're just being called from
g_io_modules_scan_all_in_directory().

https://bugzilla.gnome.org/show_bug.cgi?id=636052

Distrotech/glib-networking,GNOME/glib-networking,Distrotech/glib-networking,Distrotech/glib-networking,GNOME/glib-networking,GNOME/glib-networking