Skip to content

theading: Fix segfault in onCleanup - #30

Merged
dedmen merged 1 commit into
intercept:masterfrom
mcoffin:threading-segfault
Apr 11, 2022
Merged

dedmen merged 1 commit into
intercept:masterfrom
mcoffin:threading-segfault

Conversation

@mcoffin

@mcoffin mcoffin commented Dec 11, 2021

Copy link
Copy Markdown
Contributor

On some platforms, deleting elements from std::map::iterator while iterating through it can cause a segfault.

The reason being that calling erase() invalidates the iterator(s). This was observed to cause a problem when running intercept code on Windows 10 Server.

Despite this (apparently) not being an issue due to implementation details with g++ 11 and the MSVC runtimes on Win10 Home/Pro, this was a usage of undefined behavior, and removing it resolves the issue we observed on Win10 server.

On some platforms, deleting elements from std::map::iterator while
iterating through it can cause a segfault. erase() invalidates the
iterator
@dedmen

dedmen commented Dec 12, 2021 via email

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants