Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix modify after free crash #195

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

ernstblechaPT
Copy link

mThreadHandle must not be reset before the Thread has rejoined

@azoitl
Copy link
Contributor

azoitl commented Jul 23, 2024

This breaks restarting 4diac FORTE resources via management commands. There we only stop the thread and later want to start it again. If only stop is called then threadhandle is never set to nullHandle.

A potential solution is that end() cashes the threadhandle and resets it before join() and both end() and join() set it to nullHandle. Another option is that at the end of runThread() it is set to nullHandle

@ernstblechaPT
Copy link
Author

Thank you for the feedback, i guess setting it to nullHandle at the end of runThread() is the most sensible solution

I wasn't sure if this might lead to a race if a thread is restarted later: until runThread() has finished the following start() will fail silently?

@ernstblechaPT ernstblechaPT marked this pull request as ready for review July 24, 2024 07:21
@ernstblechaPT ernstblechaPT marked this pull request as draft July 24, 2024 08:39
mThreadHandle must not be reset before the run method has finished
@azoitl azoitl merged commit 6d6f38c into eclipse-4diac:freeze Jul 24, 2024
6 checks passed
@ernstblechaPT ernstblechaPT deleted the modify_after_free branch July 25, 2024 04:17
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