Correct me if I'm wrong but it seems to me the behaviour is perfectly fine with what your code looks like. The thing you do is more or less like the following:
1. find index of pItem which is child of pParent
2. pParent->takeItem(pItem)
3. access pItem->parent()
4. app asserts

The thing is that in (2) you remove the item from its parent, thus it doesn't have a parent anymore, therefore accessing the parent before (2) is fine, but after (2) causes the assert to fire because the parent is not valid anymore (it's null).