[cheese] Check for a valid effect in CheeseEffect
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Check for a valid effect in CheeseEffect
- Date: Sat, 10 Dec 2011 23:16:59 +0000 (UTC)
commit 357494f7206126419b883d5bf5ba17ce9b2a0052
Author: David King <amigadave amigadave com>
Date: Sat Dec 10 23:31:08 2011 +0100
Check for a valid effect in CheeseEffect
Check that the effect passed to CheeseEffect functions is valid, and
return NULL and print a critical warning otherwise.
libcheese/cheese-effect.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libcheese/cheese-effect.c b/libcheese/cheese-effect.c
index a80672d..1f6c59e 100644
--- a/libcheese/cheese-effect.c
+++ b/libcheese/cheese-effect.c
@@ -162,6 +162,8 @@ cheese_effect_class_init (CheeseEffectClass *klass)
const gchar *
cheese_effect_get_name (CheeseEffect *effect)
{
+ g_return_val_if_fail (CHEESE_IS_EFFECT (effect), NULL);
+
return effect->priv->name;
}
@@ -176,6 +178,8 @@ cheese_effect_get_name (CheeseEffect *effect)
const gchar *
cheese_effect_get_pipeline_desc (CheeseEffect *effect)
{
+ g_return_val_if_fail (CHEESE_IS_EFFECT (effect), NULL);
+
return effect->priv->pipeline_desc;
}
@@ -190,6 +194,8 @@ cheese_effect_get_pipeline_desc (CheeseEffect *effect)
gboolean
cheese_effect_is_preview_connected (CheeseEffect *effect)
{
+ g_return_val_if_fail (CHEESE_IS_EFFECT (effect), FALSE);
+
return effect->priv->control_valve != NULL;
}
@@ -202,6 +208,8 @@ cheese_effect_is_preview_connected (CheeseEffect *effect)
void
cheese_effect_enable_preview (CheeseEffect *effect)
{
+ g_return_if_fail (CHEESE_IS_EFFECT (effect));
+
g_object_set (G_OBJECT (effect->priv->control_valve), "drop", FALSE, NULL);
}
@@ -214,6 +222,8 @@ cheese_effect_enable_preview (CheeseEffect *effect)
void
cheese_effect_disable_preview (CheeseEffect *effect)
{
+ g_return_if_fail (CHEESE_IS_EFFECT (effect));
+
g_object_set (G_OBJECT (effect->priv->control_valve), "drop", TRUE, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]