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 deadlock when closing window in callback #107

Closed
wants to merge 1 commit into from

Conversation

GameParrot
Copy link
Contributor

No description provided.

Copy link
Member

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@@ -911,6 +912,7 @@ void ImGuiUIDrawFrame(GameWindow* window) {
default:
break;
}
activeWindowsLock.try_lock();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if

  • this returns false?
  • between line 852 and 915 activeWindows and activeWindows[i]->controls has been altered?

I'm more towards agreeing to wrap the content of mcpelauncher_show_window / mcpelauncher_close_window in std::thread([]() -> { <old-body> }).detach(); e.g. queue the mutex lock into it's own thread so the caller don't need to care about the consequences

@GameParrot
Copy link
Contributor Author

Closing in favor of #110

@GameParrot GameParrot closed this Dec 28, 2024
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