Crashes when dereferencing a QSharedPointer to a QMultiHash

124 Views Asked by At

I've got a QSharedPointer to a QMultiHash. When I try to get the QMultiHash from the QSharedPointer it messes up. My thinking is that the QHash part of the QMultiHash is unaccessible.

QSharedPointer<QMultiHash<int, JB_Node*>> aNewNodesMH(new QMultiHash<int, JB_Node*>());
aNewNodesMH->insert(1, pNode);

QVector<QSharedPointer<QMultiHash<int, JB_Node*>>> nodesMHV;
nodesMHV.append(aNewNodesMH);

QSharedPointer<QMultiHash<int, JB_Node*>> aMHp = nodesMHV.value(0);
QMultiHash<int, JB_Node*> aMH = (*aMHp);  // messes up here
QHashIterator<int, JB_Node*> i(aMH);
while (i.hasNext()){
    i.next();
    ....

Any way of fixing this so that it works OR is there another way of getting a Vector of QMultiHash's?

Cheers Jeff

0

There are 0 best solutions below