The MapVector type stores key-value pairs in a vector, which, when
resized, copies the entries and destroys the old ones. This causes the
underlying operations to be deleted, subsequently causing segfaults.
This patch makes the mappings map type refer to a shared pointer
instead, so that resizing the vector doesn't call the operations'
destructors.
getPayloadOp returns an iterator that skips deleted ops. It sounds like there is bug somewhere. A test case would be useful, then I can debug it.