diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-07-22 16:21:10 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-07-22 16:21:10 +0000 |
commit | 3a5a338f80e04676a80c5148064f1e48220e494c (patch) | |
tree | d4b818462ab322427201bdd4284f6e221e51a1e0 | |
parent | 433d9a5fc3538aa170d3ad1cb11929c0e5e94567 (diff) |
Fixed double delete in Stateful::add_instant_xml().
git-svn-id: svn://localhost/ardour2/trunk@690 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 4 | ||||
-rw-r--r-- | libs/ardour/session.cc | 7 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 7 | ||||
-rw-r--r-- | libs/pbd/pbd/xml++.h | 16 | ||||
-rw-r--r-- | libs/pbd/stateful.cc | 3 | ||||
-rw-r--r-- | libs/pbd/xml++.cc | 23 |
7 files changed, 27 insertions, 45 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 1887f046b8..732c829a38 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -339,15 +339,15 @@ ARDOUR_UI::save_ardour_state () Config->add_extra_xml (*node); Config->save_state(); - XMLNode* enode = new XMLNode (static_cast<Stateful*>(editor)->get_state()); - XMLNode* mnode = new XMLNode (mixer->get_state()); + XMLNode enode(static_cast<Stateful*>(editor)->get_state()); + XMLNode mnode(mixer->get_state()); if (session) { - session->add_instant_xml(*enode, session->path()); - session->add_instant_xml(*mnode, session->path()); + session->add_instant_xml (enode, session->path()); + session->add_instant_xml (mnode, session->path()); } else { - Config->add_instant_xml(*enode, get_user_ardour_path()); - Config->add_instant_xml(*mnode, get_user_ardour_path()); + Config->add_instant_xml (enode, get_user_ardour_path()); + Config->add_instant_xml (mnode, get_user_ardour_path()); } /* keybindings */ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2512c082db..24b367e921 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -913,7 +913,7 @@ Editor::set_frames_per_unit (double fpu) void Editor::instant_save () { - if (!constructed || !ARDOUR_UI::instance()->session_loaded) { + if (!constructed || !ARDOUR_UI::instance()->session_loaded) { return; } @@ -2295,7 +2295,7 @@ Editor::get_state () char buf[32]; if (is_realized()) { - Glib::RefPtr<Gdk::Window> win = get_window(); + Glib::RefPtr<Gdk::Window> win = get_window(); int x, y, xoff, yoff, width, height; win->get_root_origin(x, y); 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; |