Commit 74d6d030 authored by jan.koester's avatar jan.koester
Browse files

remove debug out

parent a36a849a
Loading
Loading
Loading
Loading
+21 −36
Original line number Diff line number Diff line
@@ -646,7 +646,6 @@ libhtmlpp::HtmlElement::~HtmlElement(){
DELETEELEMENT:
    while(cur){
        Element *next=cur->_nextElement;
        if(cur!=this){
        if(cur->getType()==HtmlEl){
            if(((HtmlElement*)cur)->_childElement){
                childs.push(((HtmlElement*)cur)->_childElement);
@@ -657,7 +656,7 @@ DELETEELEMENT:
        cur->_prevElement=nullptr;
        cur->_nextElement=nullptr;
        delelm.push(cur);
        }

        cur=next;
    }
    if(!childs.empty()){
@@ -666,15 +665,11 @@ DELETEELEMENT:
        goto DELETEELEMENT;
    }

    if(delelm.empty())
        return;

    while(!delelm.empty()){
        delete delelm.top();
        delelm.pop();
    }

    _childElement=nullptr;
}

int libhtmlpp::Element::getType() const{
@@ -778,33 +773,19 @@ libhtmlpp::HtmlElement & libhtmlpp::HtmlElement::operator=(const libhtmlpp::Html
void libhtmlpp::HtmlElement::remove(libhtmlpp::Element* el){
    Element *cur=_firstElement;

    std::stack<Element*> childs;
    std::stack<Element*> childs,dels;

DELETEELEMENT:
    while(cur){
        Element *next=cur->_nextElement;


        if(_firstElement==el)
            cur->_firstElement=_firstElement->_nextElement;

        if(cur->getType()==HtmlEl){
            if(((HtmlElement*)cur)->_childElement){
                childs.push(((HtmlElement*)cur)->_childElement);
                if(((HtmlElement*)cur)->_childElement==this)
                    ((HtmlElement*)cur)->_childElement=nullptr;
            }
                dels.push(((HtmlElement*)cur)->_childElement);
            }
        if(cur==el){
            cur->_firstElement=nullptr;
            if(cur->_prevElement)
                cur->_prevElement->_nextElement=cur->_nextElement;
            if(cur->_nextElement)
                cur->_nextElement->_prevElement=cur->_prevElement;
            cur->_prevElement=nullptr;
            cur->_nextElement=nullptr;
            delete cur;
        }

        cur=next;
    }
    if(!childs.empty()){
@@ -812,6 +793,12 @@ DELETEELEMENT:
        childs.pop();
        goto DELETEELEMENT;
    }

    while(!dels.empty()){
        Element::remove(dels.top());
        dels.pop();
    }

}


@@ -1016,16 +1003,14 @@ libhtmlpp::Element::Element(){
libhtmlpp::Element::Element(const libhtmlpp::Element& el) : Element() {
    _copy(this,&el);
}
#include <iostream>

libhtmlpp::Element::~Element(){
     Element *curel=_firstElement;

     std::cout << "el" << this << " rm: " << _firstElement << std::endl;

     while(curel){
        Element *next=curel->_nextElement;
        if(curel!=this)
        if(curel!=this){
            _firstElement->remove(curel);
        }
        curel=next;
    }
};