summaryrefslogtreecommitdiff
path: root/src/option.cpp
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2009-03-16 02:50:01 +0100
committerDennis kasprzyk <onestone@compiz-fusion.org>2009-03-16 02:50:01 +0100
commit73052cf920028426bebf2eb1def1cb2c3cf6bbc4 (patch)
treea5798b80c88246c95faff2cb45d7ddb627d2793f /src/option.cpp
parent9063d66c86f5a17cf9faec8eda2a5ea779af1658 (diff)
downloadunity-window-decorator-73052cf920028426bebf2eb1def1cb2c3cf6bbc4.tar.gz
unity-window-decorator-73052cf920028426bebf2eb1def1cb2c3cf6bbc4.tar.bz2
Check CompOption::Value type before setting it as option value.
Diffstat (limited to 'src/option.cpp')
-rw-r--r--src/option.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/option.cpp b/src/option.cpp
index e5a3870..b3fba2f 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -108,6 +108,11 @@ CompOption::Value::Value (CompOption::Type type, const Vector& l) :
set (type, l);
}
+CompOption::Type
+CompOption::Value::type () const
+{
+ return priv->type;
+}
void
CompOption::Value::set (const bool b)
@@ -717,6 +722,15 @@ CompOption::set (CompOption::Value &val)
if (isAction () && priv->type != CompOption::TypeAction)
val.action ().copyState (priv->value.action ());
+ if (priv->type != val.type () &&
+ (!isAction () || !checkIsAction (val.type ())))
+ {
+ compLogMessage ("core", CompLogLevelWarn,
+ "Can't set Value with type %d to option \"%s\" with type %d",
+ val.type (), priv->name.c_str(), priv->type);
+ return false;
+ }
+
if (priv->value == val)
return false;