[gnome-photos] base-item: Add PHOTOS_IS_BASE_ITEM guards in public functions
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] base-item: Add PHOTOS_IS_BASE_ITEM guards in public functions
- Date: Thu, 31 Mar 2016 14:05:18 +0000 (UTC)
commit b8d3f516e5ce719be53b34817a6f4d283ece5a97
Author: Rafael Fonseca <r4f4rfs gmail com>
Date: Tue Mar 29 17:38:41 2016 +0200
base-item: Add PHOTOS_IS_BASE_ITEM guards in public functions
https://bugzilla.gnome.org/show_bug.cgi?id=764083
src/photos-base-item.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 8232f02..5b6ffb3 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1706,6 +1706,7 @@ photos_base_item_can_edit (PhotosBaseItem *self)
gboolean
photos_base_item_can_trash (PhotosBaseItem *self)
{
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
return PHOTOS_BASE_ITEM_GET_CLASS (self)->trash != NULL;
}
@@ -1718,7 +1719,7 @@ photos_base_item_create_preview (PhotosBaseItem *self,
const gchar *first_property_name,
...)
{
- PhotosBaseItemPrivate *priv = self->priv;
+ PhotosBaseItemPrivate *priv;
const Babl *format;
GeglBuffer *buffer_orig = NULL;
GeglBuffer *buffer = NULL;
@@ -1744,6 +1745,9 @@ photos_base_item_create_preview (PhotosBaseItem *self,
guchar *buf = NULL;
va_list ap;
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), NULL);
+ priv = self->priv;
+
g_return_val_if_fail (operation != NULL && operation[0] != '\0', NULL);
g_return_val_if_fail (priv->buffer_source != NULL, NULL);
g_return_val_if_fail (priv->edit_graph != NULL, NULL);
@@ -1843,6 +1847,8 @@ photos_base_item_download_async (PhotosBaseItem *self,
{
GTask *task;
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
+
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, photos_base_item_download_async);
@@ -1900,9 +1906,12 @@ photos_base_item_get_bbox_edited (PhotosBaseItem *self, GeglRectangle *out_bbox)
gboolean
photos_base_item_get_bbox_source (PhotosBaseItem *self, GeglRectangle *bbox)
{
- PhotosBaseItemPrivate *priv = self->priv;
+ PhotosBaseItemPrivate *priv;
gboolean ret_val = FALSE;
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
+ priv = self->priv;
+
if (priv->buffer_source == NULL)
goto out;
@@ -2182,6 +2191,8 @@ photos_base_item_operation_add (PhotosBaseItem *self, const gchar *operation, co
{
va_list ap;
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
+
va_start (ap, first_property_name);
photos_pipeline_add (self->priv->pipeline, operation, first_property_name, ap);
va_end (ap);
@@ -2194,6 +2205,8 @@ photos_base_item_operation_get (PhotosBaseItem *self, const gchar *operation, co
gboolean ret_val;
va_list ap;
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
+
va_start (ap, first_property_name);
ret_val = photos_pipeline_get (self->priv->pipeline, operation, first_property_name, ap);
va_end (ap);
@@ -2205,6 +2218,7 @@ photos_base_item_operation_get (PhotosBaseItem *self, const gchar *operation, co
gboolean
photos_base_item_operation_remove (PhotosBaseItem *self, const gchar *operation)
{
+ g_return_val_if_fail (PHOTOS_IS_BASE_ITEM (self), FALSE);
return photos_pipeline_remove (self->priv->pipeline, operation);
}
@@ -2212,6 +2226,7 @@ photos_base_item_operation_remove (PhotosBaseItem *self, const gchar *operation)
void
photos_base_item_operations_revert (PhotosBaseItem *self)
{
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
return photos_pipeline_revert (self->priv->pipeline);
}
@@ -2260,6 +2275,7 @@ photos_base_item_pipeline_save_finish (PhotosBaseItem *self, GAsyncResult *res,
void
photos_base_item_pipeline_snapshot (PhotosBaseItem *self)
{
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
return photos_pipeline_snapshot (self->priv->pipeline);
}
@@ -2267,6 +2283,7 @@ photos_base_item_pipeline_snapshot (PhotosBaseItem *self)
void
photos_base_item_print (PhotosBaseItem *self, GtkWidget *toplevel)
{
+ g_return_if_fail (PHOTOS_IS_BASE_ITEM (self));
photos_base_item_load_async (self, NULL, photos_base_item_print_load, g_object_ref (toplevel));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]