Loading src/html.cpp +54 −26 Original line number Diff line number Diff line Loading @@ -637,11 +637,12 @@ libhtmlpp::HtmlElement::~HtmlElement(){ } Element *cur=_childElement; DELETEELEMENT: std::stack<Element*> childs; std::stack<Element*> delelm; if(cur && (cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement) ){ DELETEELEMENT: if(cur){ if((cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement) ){ while(cur){ Element *next=cur->nextElement(); cur->_nextElement=nullptr; Loading @@ -656,11 +657,29 @@ DELETEELEMENT: } if(!childs.empty()){ cur=childs.top(); childs.pop(); goto DELETEELEMENT; } } while(!delelm.empty()){ delete delelm.top(); Element *itm=delelm.top(); if(itm!=this){ switch(itm->getType()){ case HtmlEl: delete (HtmlElement*)itm; break; case TextEl: delete (TextElement*)itm; break; case CommentEl: delete (CommentElement*)itm; break; default: break; } } delelm.pop(); } } Loading Loading @@ -820,12 +839,21 @@ NEWEL: Element* next=src->nextElement(); if(next){ if(next->getType()==HtmlEl) switch(next->getType()){ case HtmlEl: dest->_nextElement= new HtmlElement(); else if(next->getType()==TextEl) break; case TextEl: dest->_nextElement= new TextElement(); else if(next->getType()==CommentEl) break; case CommentEl: dest->_nextElement= new CommentElement(); break; default: HTMLException ex; ex[HTMLException::Critical] << "Unknown html element found !"; throw ex; } prev=dest; src=next; dest=dest->_nextElement; Loading Loading
src/html.cpp +54 −26 Original line number Diff line number Diff line Loading @@ -637,11 +637,12 @@ libhtmlpp::HtmlElement::~HtmlElement(){ } Element *cur=_childElement; DELETEELEMENT: std::stack<Element*> childs; std::stack<Element*> delelm; if(cur && (cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement) ){ DELETEELEMENT: if(cur){ if((cur->_Type==HtmlEl && ((HtmlElement*)cur)->_childElement) ){ while(cur){ Element *next=cur->nextElement(); cur->_nextElement=nullptr; Loading @@ -656,11 +657,29 @@ DELETEELEMENT: } if(!childs.empty()){ cur=childs.top(); childs.pop(); goto DELETEELEMENT; } } while(!delelm.empty()){ delete delelm.top(); Element *itm=delelm.top(); if(itm!=this){ switch(itm->getType()){ case HtmlEl: delete (HtmlElement*)itm; break; case TextEl: delete (TextElement*)itm; break; case CommentEl: delete (CommentElement*)itm; break; default: break; } } delelm.pop(); } } Loading Loading @@ -820,12 +839,21 @@ NEWEL: Element* next=src->nextElement(); if(next){ if(next->getType()==HtmlEl) switch(next->getType()){ case HtmlEl: dest->_nextElement= new HtmlElement(); else if(next->getType()==TextEl) break; case TextEl: dest->_nextElement= new TextElement(); else if(next->getType()==CommentEl) break; case CommentEl: dest->_nextElement= new CommentElement(); break; default: HTMLException ex; ex[HTMLException::Critical] << "Unknown html element found !"; throw ex; } prev=dest; src=next; dest=dest->_nextElement; Loading