[Merge] lp:~artmello/webbrowser-app/webbrowser-app-swipe_to_delete into lp:webbrowser-app

Olivier Tilloy olivier.tilloy at canonical.com
Tue Aug 5 09:18:37 UTC 2014


Review: Needs Fixing

150	+    for (int i = 0; i < m_entries.count(); ++i) {
151	+        if (m_entries.at(i).domain == domain) {
152	+            removeByIndex(i);
153	+        }
154	+    }

This cannot work: as soon as you remove one entry from the model, the iterator becomes invalid (it’s pointing one item forward).
To implement the above safely, use a for loop that starts from the end of the model and decrements i until it reaches the beginning. Or use STL-style iterators with a while loop.
-- 
https://code.launchpad.net/~artmello/webbrowser-app/webbrowser-app-swipe_to_delete/+merge/229550
Your team Ubuntu Phablet Team is subscribed to branch lp:webbrowser-app.



More information about the Ubuntu-reviews mailing list