Possible bug in EndChangeSetBatch

Nov 17, 2015 at 3:09 PM
I'm using this undo redo code with really good success so far.

However, I ran into an issue where I could have nested begin and end batches.

The BeginChangeSetBatch checks the _IsUndoingOrRedoing flag but the EndChangeSetBatch does not. Shouldn't the EndChangeSetBatch check that same flag?
Nov 17, 2015 at 3:24 PM
Now that I've looked at this more. I think the EndChangeSetBatch is fine.

However, in the BeginChangeSetBatch method, shouldn't the counter _IsInBatchCounter be set before checking the _IsUndoingOrRedoing flag?

With nested calls to BeginChangeSetBatch the counter will only go up to 1. Then the EndChangeSetBatch will go back to 0 sooner than it should.