diff options
author | Vojtech Bocek <vbocek@gmail.com> | 2015-01-12 18:29:12 +0100 |
---|---|---|
committer | Dees Troy <dees_troy@teamw.in> | 2015-01-12 20:23:37 +0100 |
commit | e979abd6ccc120cddcef11e535607462b6bc2adc (patch) | |
tree | 24ea28438f51c4d29e1d0565e13fbbed040f59a1 /gui/pages.cpp | |
parent | Fix some actions being incorrectly threaded (diff) | |
download | android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar.gz android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar.bz2 android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar.lz android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar.xz android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.tar.zst android_bootable_recovery-e979abd6ccc120cddcef11e535607462b6bc2adc.zip |
Diffstat (limited to '')
-rw-r--r-- | gui/pages.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp index aae85aec9..94c351be2 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -557,11 +557,16 @@ PageSet::~PageSet() { for (std::vector<Page*>::iterator itr = mPages.begin(); itr != mPages.end(); ++itr) delete *itr; - for (std::vector<xml_node<>*>::iterator itr2 = templates.begin(); itr2 != templates.end(); ++itr2) - delete *itr2; delete mResources; free(mXmlFile); + + mDoc.clear(); + + for (std::vector<xml_document<>*>::iterator itr = mIncludedDocs.begin(); itr != mIncludedDocs.end(); ++itr) { + (*itr)->clear(); + delete *itr; + } } int PageSet::Load(ZipArchive* package) @@ -605,7 +610,7 @@ int PageSet::Load(ZipArchive* package) return -1; } } - + return CheckInclude(package, &mDoc); } @@ -620,7 +625,7 @@ int PageSet::CheckInclude(ZipArchive* package, xml_document<> *parentDoc) long len; char* xmlFile = NULL; string filename; - xml_document<> doc; + xml_document<> *doc = NULL; par = parentDoc->first_node("recovery"); if (!par) { @@ -682,11 +687,14 @@ int PageSet::CheckInclude(ZipArchive* package, xml_document<> *parentDoc) return -1; } } - doc.parse<0>(xmlFile); - parent = doc.first_node("recovery"); + xmlFile[len] = '\0'; + doc = new xml_document<>(); + doc->parse<0>(xmlFile); + + parent = doc->first_node("recovery"); if (!parent) - parent = doc.first_node("install"); + parent = doc->first_node("install"); // Now, let's parse the XML LOGINFO("Loading included resources...\n"); @@ -711,11 +719,17 @@ int PageSet::CheckInclude(ZipArchive* package, xml_document<> *parentDoc) templates.push_back(xmltemplate); child = parent->first_node("pages"); - if (child) - if (LoadPages(child)) - return -1; + if (child && LoadPages(child)) + { + templates.pop_back(); + doc->clear(); + delete doc; + return -1; + } + + mIncludedDocs.push_back(doc); - if (CheckInclude(package, &doc)) + if (CheckInclude(package, doc)) return -1; chld = chld->next_sibling("xmlfile"); |