I don't think it is safe to modify mNotifications inside this loop - foreach takes the value of end() at initialization, rather than at each test.