qtwebdriver icon indicating copy to clipboard operation
qtwebdriver copied to clipboard

Problem on Session::UpdateViews function causing seg fault.

Open efauk opened this issue 7 years ago • 0 comments

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.

efauk avatar Jun 14 '17 14:06 efauk