cisco-open-source / qtwebdriver

WebDriver implementation for Qt
https://github.com/cisco-open-source/qtwebdriver/wiki
197 stars 59 forks source link

Problem on Session::UpdateViews function causing seg fault. #49

Open efauk opened 7 years ago

efauk commented 7 years ago
void Session::UpdateViews(const std::set<ViewId>& views) {
    ViewsMap::iterator it;
    ViewId vi;

    for (it = views_.begin(); it != views_.end(); ++it) {
        vi = ViewId(it->first);

        if (vi.is_valid() && 0 == views.count(vi)) {
            // invalidate handle
            RemoveView(vi);
        }
    }
}

The RemoveView function deletes elements of the container _views__. That operation invalidates the iterator, according to http://en.cppreference.com/w/cpp/container/set/erase, causing a seg fault.

Found on MAC.