Bug 1356718 - Query gtk settings schemas to avoid crashing when schema is missing. r=jfkthame

MozReview-Commit-ID: 2rqO4XpLbfO

--HG--
extra : rebase_source : a6f20cefa04c37bf73574f9065a63e375891bd03
This commit is contained in:
Zibi Braniecki 2017-04-16 00:13:07 -07:00
Родитель 48a997a3cb
Коммит efe35ec119
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -61,7 +61,20 @@ HourCycle()
key = "clock-format";
}
GSettings* settings = g_settings_new(schema);
// This is a workaround for old GTK versions.
// Once we bump the minimum version to 2.40 we should replace
// this with g_settings_schme_source_lookup.
// See bug 1356718 for details.
const char* const* schemas = g_settings_list_schemas();
GSettings* settings = nullptr;
for (uint32_t i = 0; schemas[i] != nullptr; i++) {
if (strcmp(schemas[i], schema) == 0) {
settings = g_settings_new(schema);
break;
}
}
if (settings) {
// We really want to use g_settings_get_user_value which will
// only want to take it if user manually changed the value.