Added a new Windows-only startup helper, win32_set_gsettings_schema_dir(), that sets GSETTINGS_SCHEMA_DIR to <install-dir>/share/glib-2.0/schemas when the environment variable is not already set and the directory exists. This is intended to prevent GTK/GSettings initialization failures (like the file chooser crash path you shared).

Called that helper in fe_args() before gtk_init() on Windows so schema resolution is configured early in process startup.
This commit is contained in:
2026-02-15 16:37:51 -07:00
parent 7f4ffdb1e5
commit b569d24cd1

View File

@@ -115,6 +115,27 @@ create_msg_dialog (gchar *title, gchar *message)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
static void
win32_set_gsettings_schema_dir (void)
{
char *base_path;
char *schema_path;
if (g_getenv ("GSETTINGS_SCHEMA_DIR") != NULL)
return;
base_path = g_win32_get_package_installation_directory_of_module (NULL);
if (base_path == NULL)
return;
schema_path = g_build_filename (base_path, "share", "glib-2.0", "schemas", NULL);
if (g_file_test (schema_path, G_FILE_TEST_IS_DIR))
g_setenv ("GSETTINGS_SCHEMA_DIR", schema_path, FALSE);
g_free (schema_path);
g_free (base_path);
}
#endif
int
@@ -224,6 +245,8 @@ fe_args (int argc, char *argv[])
}
#ifdef WIN32
win32_set_gsettings_schema_dir ();
/* this is mainly for irc:// URL handling. When windows calls us from */
/* I.E, it doesn't give an option of "Start in" directory, like short */
/* cuts can. So we have to set the current dir manually, to the path */