summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/option.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/option.cpp b/src/option.cpp
index 78fdc0f..36ad066 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -406,12 +406,38 @@ CompOption::Value::operator!= (const CompOption::Value &val)
return !(*this == val);
}
+static void
+finiOptionValue (CompOption::Value &v,
+ CompOption::Type type)
+{
+ switch (type) {
+ case CompOption::TypeAction:
+ case CompOption::TypeKey:
+ case CompOption::TypeButton:
+ case CompOption::TypeEdge:
+ case CompOption::TypeBell:
+ if (v.action ().state () & CompAction::StateAutoGrab && screen)
+ screen->removeAction (&v.action ());
+ break;
+
+ case CompOption::TypeList:
+ foreach (CompOption::Value &val, v.list ())
+ finiOptionValue (val, v.listType ());
+ break;
+
+ default:
+ break;
+ }
+}
+
CompOption::Value &
CompOption::Value::operator= (const CompOption::Value &val)
{
if (this == &val)
return *this;
+ finiOptionValue (*this, priv->type);
+
delete priv;
priv = new PrivateValue (*val.priv);
@@ -661,30 +687,6 @@ finiScreenOptionValue (CompScreen *s,
}
}
-static void
-finiOptionValue (CompOption::Value &v,
- CompOption::Type type)
-{
- switch (type) {
- case CompOption::TypeAction:
- case CompOption::TypeKey:
- case CompOption::TypeButton:
- case CompOption::TypeEdge:
- case CompOption::TypeBell:
- if (v.action ().state () & CompAction::StateAutoGrab && screen)
- screen->removeAction (&v.action ());
- break;
-
- case CompOption::TypeList:
- foreach (CompOption::Value &val, v.list ())
- finiOptionValue (val, v.listType ());
- break;
-
- default:
- break;
- }
-}
-
CompOption::~CompOption ()
{
finiOptionValue (priv->value, priv->type);