We face numerous assertions in shared_ptr<PropertyNode> operator ->
One repeating assertion is in Device::setBinaryInputs
2698: PropertyNodePtr binaryInputNode;
2699: if (m_pPropertyNode != NULL) {
2700: binaryInputNode = m_pPropertyNode->getPropertyByName("binaryInputs");
2701: if (binaryInputNode != NULL) {
2702: binaryInputNode->getParentNode()->removeChild(binaryInputNode);
2703: }
2704: binaryInputNode = m_pPropertyNode->createProperty("binaryInputs");
2705: }
Disassembled code shows that m_pPropertyNode
is read from this
on line 2699 and again on line 2704.
Member m_pPropertyNode
was !0 on line 2699.
Member m_pPropertyNode
was 0 on line 2704.
The only place where m_pPropertyNode
is cleared
is inside removeFromPropertyTree
.
This is minimal fix attempting to fix the assert.
I am not sure whether taking the lock in removeFromProperty
introduces possible deadlock or not.
Although I did not find any obvious problem,
both setBinaryInputs
and removeFromProperty
call
nontrivial code outside of Device class that may do locking.
We have more methods that are not locked and use m_pPropertyNode. We may want to introduce locking there. But without correct locking model it increases deadlocks risk.