mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
[gsettings] Add g_return_*_if_fail() guards
Reported by Christian Persch here: https://bugzilla.gnome.org/show_bug.cgi?id=616405
This commit is contained in:
parent
78ed401a51
commit
0fa791b29d
@ -393,6 +393,8 @@ g_settings_init (GSettings *settings)
|
|||||||
void
|
void
|
||||||
g_settings_delay (GSettings *settings)
|
g_settings_delay (GSettings *settings)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (G_IS_SETTINGS (settings));
|
||||||
|
|
||||||
if (settings->priv->delayed)
|
if (settings->priv->delayed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -496,6 +498,8 @@ g_settings_set_property (GObject *object,
|
|||||||
gboolean
|
gboolean
|
||||||
g_settings_get_has_unapplied (GSettings *settings)
|
g_settings_get_has_unapplied (GSettings *settings)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE);
|
||||||
|
|
||||||
return settings->priv->delayed &&
|
return settings->priv->delayed &&
|
||||||
g_delayed_settings_backend_get_has_unapplied (
|
g_delayed_settings_backend_get_has_unapplied (
|
||||||
G_DELAYED_SETTINGS_BACKEND (settings->priv->backend));
|
G_DELAYED_SETTINGS_BACKEND (settings->priv->backend));
|
||||||
@ -736,6 +740,8 @@ g_settings_get_value (GSettings *settings,
|
|||||||
GVariant *sval;
|
GVariant *sval;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_SETTINGS (settings), NULL);
|
||||||
|
|
||||||
sval = g_settings_schema_get_value (settings->priv->schema, key, &options);
|
sval = g_settings_schema_get_value (settings->priv->schema, key, &options);
|
||||||
|
|
||||||
if G_UNLIKELY (sval == NULL)
|
if G_UNLIKELY (sval == NULL)
|
||||||
@ -842,6 +848,8 @@ g_settings_set_value (GSettings *settings,
|
|||||||
GVariant *sval;
|
GVariant *sval;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE);
|
||||||
|
|
||||||
sval = g_settings_schema_get_value (settings->priv->schema, key, NULL);
|
sval = g_settings_schema_get_value (settings->priv->schema, key, NULL);
|
||||||
correct_type = g_variant_is_of_type (value, g_variant_get_type (sval));
|
correct_type = g_variant_is_of_type (value, g_variant_get_type (sval));
|
||||||
g_variant_unref (sval);
|
g_variant_unref (sval);
|
||||||
@ -945,6 +953,8 @@ g_settings_is_writable (GSettings *settings,
|
|||||||
gboolean writable;
|
gboolean writable;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE);
|
||||||
|
|
||||||
path = g_strconcat (settings->priv->path, name, NULL);
|
path = g_strconcat (settings->priv->path, name, NULL);
|
||||||
writable = g_settings_backend_get_writable (settings->priv->backend, path);
|
writable = g_settings_backend_get_writable (settings->priv->backend, path);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
@ -976,6 +986,8 @@ g_settings_get_child (GSettings *settings,
|
|||||||
gchar *child_name;
|
gchar *child_name;
|
||||||
GSettings *child;
|
GSettings *child;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_SETTINGS (settings), NULL);
|
||||||
|
|
||||||
child_name = g_strconcat (name, "/", NULL);
|
child_name = g_strconcat (name, "/", NULL);
|
||||||
child_schema = g_settings_schema_get_value (settings->priv->schema,
|
child_schema = g_settings_schema_get_value (settings->priv->schema,
|
||||||
child_name, NULL);
|
child_name, NULL);
|
||||||
@ -1304,6 +1316,8 @@ g_settings_bind_with_mapping (GSettings *settings,
|
|||||||
gchar *detailed_signal;
|
gchar *detailed_signal;
|
||||||
GQuark binding_quark;
|
GQuark binding_quark;
|
||||||
|
|
||||||
|
g_return_if_fail (G_IS_SETTINGS (settings));
|
||||||
|
|
||||||
objectclass = G_OBJECT_GET_CLASS (object);
|
objectclass = G_OBJECT_GET_CLASS (object);
|
||||||
|
|
||||||
binding = g_slice_new0 (GSettingsBinding);
|
binding = g_slice_new0 (GSettingsBinding);
|
||||||
@ -1495,6 +1509,8 @@ g_settings_bind_writable (GSettings *settings,
|
|||||||
gchar *detailed_signal;
|
gchar *detailed_signal;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
|
||||||
|
g_return_if_fail (G_IS_SETTINGS (settings));
|
||||||
|
|
||||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), property);
|
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), property);
|
||||||
if (pspec == NULL)
|
if (pspec == NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user