13
0

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
This commit is contained in:
Carl Hetherington 2011-12-17 16:37:18 +00:00
parent 85b75a0ab1
commit 39f765614a
3 changed files with 9 additions and 10 deletions

View File

@ -1301,7 +1301,7 @@ Region::send_change (const PropertyChange& what_changed)
Stateful::send_change (what_changed);
if (!Stateful::frozen()) {
if (!Stateful::property_changes_suspended()) {
/* Try and send a shared_pointer unless this is part of the constructor.
If so, do nothing.

View File

@ -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

View File

@ -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;
}