summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-12-17 16:37:18 +0000
committerCarl Hetherington <carl@carlh.net>2011-12-17 16:37:18 +0000
commit39f765614a7964e07c55a57ba854f8524807d6cb (patch)
tree3d3ff60e0867099f991e669044b4c5c234413917 /libs/pbd
parent85b75a0ab1c3c342cde0f0cdae71fea87a57ff20 (diff)
Clear up confusion with overloads of _frozen and frozen()
meaning different things. git-svn-id: svn://localhost/ardour2/branches/3.0@11016 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/pbd/stateful.h7
-rw-r--r--libs/pbd/stateful.cc10
2 files changed, 8 insertions, 9 deletions
diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h
index 2d5b2a0990..506d058773 100644
--- a/libs/pbd/pbd/stateful.h
+++ b/libs/pbd/pbd/stateful.h
@@ -90,9 +90,9 @@ class Stateful {
virtual void suspend_property_changes ();
virtual void resume_property_changes ();
-
- virtual bool frozen() const { return _frozen; }
+ bool property_changes_suspended() const { return g_atomic_int_get (&_stateful_frozen) > 0; }
+
protected:
void add_instant_xml (XMLNode&, const sys::path& directory_path);
@@ -109,7 +109,6 @@ class Stateful {
XMLNode *_extra_xml;
XMLNode *_instant_xml;
- int32_t _frozen;
PBD::PropertyChange _pending_changed;
Glib::Mutex _lock;
@@ -121,10 +120,10 @@ class Stateful {
within thaw() just before send_change() is called.
*/
virtual void mid_thaw (const PropertyChange&) { }
- bool property_changes_suspended() const { return g_atomic_int_get (&_frozen) > 0; }
private:
PBD::ID _id;
+ int32_t _stateful_frozen;
};
} // namespace PBD
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index b2c76f452f..0cea6324f5 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -39,8 +39,8 @@ int Stateful::current_state_version = 0;
int Stateful::loading_state_version = 0;
Stateful::Stateful ()
- : _frozen (0)
- , _properties (new OwnedPropertyList)
+ : _properties (new OwnedPropertyList)
+ , _stateful_frozen (0)
{
_extra_xml = 0;
_instant_xml = 0;
@@ -275,7 +275,7 @@ Stateful::send_change (const PropertyChange& what_changed)
{
Glib::Mutex::Lock lm (_lock);
- if (_frozen) {
+ if (property_changes_suspended ()) {
_pending_changed.add (what_changed);
return;
}
@@ -287,7 +287,7 @@ Stateful::send_change (const PropertyChange& what_changed)
void
Stateful::suspend_property_changes ()
{
- _frozen++;
+ g_atomic_int_add (&_stateful_frozen, 1);
}
void
@@ -298,7 +298,7 @@ Stateful::resume_property_changes ()
{
Glib::Mutex::Lock lm (_lock);
- if (_frozen && --_frozen > 0) {
+ if (property_changes_suspended() && g_atomic_int_dec_and_test (&_stateful_frozen) == FALSE) {
return;
}