Skip to content

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

@efauk

Description

@efauk
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions