From 254b8dfcd0138dba835fe5caf535118c74685a3b Mon Sep 17 00:00:00 2001 From: Juan Pablo Ugarte Date: Fri, 25 Apr 2014 19:35:58 -0300 Subject: [PATCH] Added type check to GPermission public functions. --- gio/gpermission.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gio/gpermission.c b/gio/gpermission.c index 371e09d..0fcd17e 100644 --- a/gio/gpermission.c +++ b/gio/gpermission.c @@ -106,6 +106,7 @@ g_permission_acquire (GPermission *permission, GCancellable *cancellable, GError **error) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return G_PERMISSION_GET_CLASS (permission) ->acquire (permission, cancellable, error); } @@ -130,6 +131,7 @@ g_permission_acquire_async (GPermission *permission, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (G_IS_PERMISSION (permission)); G_PERMISSION_GET_CLASS (permission) ->acquire_async (permission, cancellable, callback, user_data); } @@ -155,6 +157,7 @@ g_permission_acquire_finish (GPermission *permission, GAsyncResult *result, GError **error) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return G_PERMISSION_GET_CLASS (permission) ->acquire_finish (permission, result, error); } @@ -190,6 +193,7 @@ g_permission_release (GPermission *permission, GCancellable *cancellable, GError **error) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return G_PERMISSION_GET_CLASS (permission) ->release (permission, cancellable, error); } @@ -214,6 +218,7 @@ g_permission_release_async (GPermission *permission, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (G_IS_PERMISSION (permission)); G_PERMISSION_GET_CLASS (permission) ->release_async (permission, cancellable, callback, user_data); } @@ -239,6 +244,7 @@ g_permission_release_finish (GPermission *permission, GAsyncResult *result, GError **error) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return G_PERMISSION_GET_CLASS (permission) ->release_finish (permission, result, error); } @@ -258,6 +264,7 @@ g_permission_release_finish (GPermission *permission, gboolean g_permission_get_allowed (GPermission *permission) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return permission->priv->allowed; } @@ -276,6 +283,7 @@ g_permission_get_allowed (GPermission *permission) gboolean g_permission_get_can_acquire (GPermission *permission) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return permission->priv->can_acquire; } @@ -294,6 +302,7 @@ g_permission_get_can_acquire (GPermission *permission) gboolean g_permission_get_can_release (GPermission *permission) { + g_return_val_if_fail (G_IS_PERMISSION (permission), FALSE); return permission->priv->can_release; } @@ -318,8 +327,11 @@ g_permission_impl_update (GPermission *permission, gboolean can_acquire, gboolean can_release) { - GObject *object = G_OBJECT (permission); + GObject *object; + g_return_if_fail (G_IS_PERMISSION (permission)); + + object = G_OBJECT (permission); g_object_freeze_notify (object); allowed = allowed != FALSE; -- 2.7.4