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

Remove wrapper to UnloadLevel call to fix crash #292

Closed

Conversation

slash-under
Copy link

@slash-under slash-under commented Sep 30, 2022

Fixes #291

This assumes that there is no case where the call will occur off the main thread -- if so, the existing call could be wrapped in a try/catch to isolate this fix.

@slash-under slash-under changed the title Remove wrapper to UnloadLevel call to fix crash -- Fixes #291 Remove wrapper to UnloadLevel call to fix crash Sep 30, 2022
@DominicMaas
Copy link
Member

A better way could potentially be checking if we are already in that thread, if not, then queue it (if this is possible we should also take a look at all queuing code throughout the mod as well and apply the same fix).

@kaenganxt
Copy link
Member

That is definitely necessary, as we might call the Disconnect method from different threads. The QueueMainThread method should already check if it is in the main thread and execute it directly if that is the case. It looks correct in the decompiled code, but it doesn't seem to work properly when looking at the reported stack trace. This might be a problem due to shutdown of the game.

We should investigate that problem further, but for this particular issue, I would propose a different fix. I think we should always execute the Disconnect method in the simulation thread to prevent any race conditions on the different modules that are reset.
Then the QueueMainThread should also work again (probably).

@slash-under slash-under marked this pull request as draft October 4, 2022 15:32
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.

Crash when disconnecting
3 participants