Fix an INVALIDATE_ITERATOR defect reported by Coverity.

std::vector::erase() invalidates the iterator, so we need
to advance the iterator by using the return value of erase().

R=nealsid
A=wtc



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@370 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
nealsid 2009-07-30 22:53:09 +00:00
parent 0d23e8c686
commit f3f7df33de

View file

@ -249,12 +249,12 @@ ExceptionHandler::~ExceptionHandler() {
// TODO(mmentovai): use advapi32!ReportEvent to log the warning to the // TODO(mmentovai): use advapi32!ReportEvent to log the warning to the
// system's application event log. // system's application event log.
fprintf(stderr, "warning: removing Breakpad handler out of order\n"); fprintf(stderr, "warning: removing Breakpad handler out of order\n");
for (vector<ExceptionHandler*>::iterator iterator = vector<ExceptionHandler*>::iterator iterator = handler_stack_->begin();
handler_stack_->begin(); while (iterator != handler_stack_->end()) {
iterator != handler_stack_->end();
++iterator) {
if (*iterator == this) { if (*iterator == this) {
handler_stack_->erase(iterator); iterator = handler_stack_->erase(iterator);
} else {
++iterator;
} }
} }
} }