miasmod: Fix crash when clearing dirty nodes

Storing these as an index was buggy, since the index could become invalid, the
node it was pointing to could be garbage collected and attempting to retrieve
it's private pointer could result in a crash.

Instead just search the whole tree for dirty nodes and clear them directly. Use
a new helper function to return a list of row numbers going down the tree to
the dirty nodes, so we can use that to quickly get a QModelIndex to the rows
that need to be redrawn.