summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2006-07-22 16:21:10 +0000
committerTaybin Rutkin <taybin@taybin.com>2006-07-22 16:21:10 +0000
commit3a5a338f80e04676a80c5148064f1e48220e494c (patch)
treed4b818462ab322427201bdd4284f6e221e51a1e0 /libs
parent433d9a5fc3538aa170d3ad1cb11929c0e5e94567 (diff)
Fixed double delete in Stateful::add_instant_xml().
git-svn-id: svn://localhost/ardour2/trunk@690 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session.cc7
-rw-r--r--libs/ardour/session_state.cc7
-rw-r--r--libs/pbd/pbd/xml++.h16
-rw-r--r--libs/pbd/stateful.cc3
-rw-r--r--libs/pbd/xml++.cc23
5 files changed, 19 insertions, 37 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 3f400b0b2b..34807e798b 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3558,13 +3558,6 @@ Session::allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howma
_npan_buffers = howmany;
}
-void
-Session::add_instant_xml (XMLNode& node, const std::string& dir)
-{
- Stateful::add_instant_xml (node, dir);
- Config->add_instant_xml (node, get_user_ardour_path());
-}
-
int
Session::freeze (InterThreadInfo& itt)
{
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 35d56760a9..6fb60ebcab 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -3284,3 +3284,10 @@ Session::controllable_by_id (const PBD::ID& id)
return 0;
}
+
+void
+Session::add_instant_xml (XMLNode& node, const std::string& dir)
+{
+ Stateful::add_instant_xml (node, dir);
+ Config->add_instant_xml (node, get_user_ardour_path());
+}
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index afb896e1d5..5dcb4f084a 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -37,7 +37,6 @@ private:
string _filename;
XMLNode *_root;
int _compression;
- bool _initialized;
public:
XMLTree();
@@ -45,9 +44,8 @@ public:
XMLTree(const XMLTree *);
~XMLTree();
- bool initialized() const { return _initialized; };
XMLNode *root() const { return _root; };
- XMLNode *set_root(XMLNode *n) { _initialized = true; return _root = n; };
+ XMLNode *set_root(XMLNode *n) { return _root = n; };
const string & filename() const { return _filename; };
const string & set_filename(const string &fn) { return _filename = fn; };
@@ -69,7 +67,6 @@ public:
class XMLNode {
private:
- bool _initialized;
string _name;
bool _is_content;
string _content;
@@ -83,18 +80,17 @@ public:
XMLNode(const XMLNode&);
~XMLNode();
- bool initialized() const { return _initialized; };
const string name() const { return _name; };
bool is_content() const { return _is_content; };
const string & content() const { return _content; };
- const string & set_content(const string &);
+ const string & set_content (const string &);
XMLNode *add_content(const string & = string());
- const XMLNodeList & children(const string & = string()) const;
- XMLNode *add_child(const char *);
- XMLNode *add_child_copy(const XMLNode&);
- void add_child_nocopy (XMLNode&);
+ const XMLNodeList & children (const string & = string()) const;
+ XMLNode *add_child (const char *);
+ XMLNode *add_child_copy (const XMLNode&);
+ void add_child_nocopy (XMLNode&);
const XMLPropertyList & properties() const { return _proplist; };
XMLProperty *property(const char * );
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index f0f820fe9d..786410e817 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -82,7 +82,7 @@ Stateful::add_instant_xml (XMLNode& node, const string& dir)
}
_instant_xml->remove_nodes_and_delete (node.name());
- _instant_xml->add_child_nocopy (node);
+ _instant_xml->add_child_copy (node);
XMLTree tree;
tree.set_filename(dir+"/instant.xml");
@@ -134,4 +134,3 @@ Stateful::instant_xml (const string& str, const string& dir)
return 0;
}
-
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc
index dec5c346cc..03fa116279 100644
--- a/libs/pbd/xml++.cc
+++ b/libs/pbd/xml++.cc
@@ -12,17 +12,15 @@ static void writenode(xmlDocPtr, XMLNode *, xmlNodePtr, int);
XMLTree::XMLTree()
: _filename(),
- _root(),
- _compression(0),
- _initialized(false)
+ _root(0),
+ _compression(0)
{
}
XMLTree::XMLTree(const string &fn)
: _filename(fn),
_root(0),
- _compression(0),
- _initialized(false)
+ _compression(0)
{
read();
}
@@ -32,13 +30,13 @@ XMLTree::XMLTree(const XMLTree * from)
_filename = from->filename();
_root = new XMLNode(*from->root());
_compression = from->compression();
- _initialized = true;
}
XMLTree::~XMLTree()
{
- if (_initialized && _root)
+ if (_root) {
delete _root;
+ }
}
int
@@ -69,13 +67,11 @@ XMLTree::read(void)
doc = xmlParseFile(_filename.c_str());
if (!doc) {
- _initialized = false;
return false;
}
_root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);
- _initialized = true;
return true;
}
@@ -94,13 +90,11 @@ XMLTree::read_buffer(const string & buffer)
doc = xmlParseMemory((char *) buffer.c_str(), buffer.length());
if (!doc) {
- _initialized = false;
return false;
}
_root = readnode(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);
- _initialized = true;
return true;
}
@@ -166,21 +160,14 @@ XMLTree::write_buffer(void) const
XMLNode::XMLNode(const string & n)
: _name(n), _is_content(false), _content(string())
{
- if (_name.empty()) {
- _initialized = false;
- } else {
- _initialized = true;
- }
}
XMLNode::XMLNode(const string & n, const string & c)
:_name(n), _is_content(true), _content(c)
{
- _initialized = true;
}
XMLNode::XMLNode(const XMLNode& from)
- : _initialized(false)
{
XMLPropertyList props;
XMLPropertyIterator curprop;