Beng abnormal characteristics of the recording when traversing QMap

// crash wording 
    for (Auto var = valueRow.mapValue () the begin ();. Var ! = ValueRow.mapValue () End ();. Var ++ )
    {
        if (!var.value().isValid() || var.value().isNull())
            continue;
        this->addItem(var.key(), var.value());
    }


// not collapse wording 
    The QMap < int , the QVariant> valueRow_ =   valueRow.mapValue ();
     for (Auto var = valueRow_.cbegin (); var ! = ValueRow_.cend (); var ++ )
    {
        if (!var.value().isValid() || var.value().isNull())
            continue;
        this->addItem(var.key(), var.value());
    }


// scene of an accident 
struct QMapNode: public QMapNodeBase
{
...
...   

    inline QMapNode *nextNode() { return reinterpret_cast<QMapNode *>(QMapNodeBase::nextNode()); }

...
...



Essentially no difference, why would crash ??? 
:: Zheng Tao, head of analysis:
var! = valueRow.mapValue (). end () every time a new copy. But is var var = valueRow.mapValue (). () Copies begin here. Every copy Beng not the same result.

 

Guess you like

Origin www.cnblogs.com/azbane/p/12103154.html