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

Use custom WaitForMultipleObjectsEx to prevent STA/COM reentrancy #4242

Merged
merged 5 commits into from
Jul 15, 2020

Conversation

kekekeks
Copy link
Member

@kekekeks kekekeks commented Jul 7, 2020

@MarchingCube
Copy link
Collaborator

MarchingCube commented Jul 7, 2020

I think .Net screws us over here completely, I wonder if we actually have to handle WM_PAINT at all? And instead repaint during resize.

dotnet/runtime#12107 (comment)

@kekekeks
Copy link
Member Author

kekekeks commented Jul 7, 2020

WM_PAINT still has to trigger a repaint since it's being sent in certain situations when window contents are lost

@kekekeks kekekeks changed the title Use custom WaitForMultipleObjectsEx to prevent STA/COM fuckery Use custom WaitForMultipleObjectsEx to prevent STA/COM reentrancy Jul 7, 2020
@MarchingCube
Copy link
Collaborator

@kekekeks If I remember correctly - your plan was to add message polling for certain scenarios? Or we want to disable all messages?

@kekekeks
Copy link
Member Author

I think we should disable all messages to prevent all possible reentrancy scenarios. It should be safe to do for all managed locks in Avalonia code and for all managed locks in normal (non-COM) code.

If some COM component requires message pumping inside of Monitor.Enter and can't wait for a normal GetMessage/DispatchMessage, said COM object is considered to be incompatible with common sense and, by extension, with Avalonia, and should run on a dedicated STA thread.

Copy link
Collaborator

@MarchingCube MarchingCube left a comment

Choose a reason for hiding this comment

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

LGTM.

@kekekeks kekekeks merged commit 5ed130e into master Jul 15, 2020
@kekekeks kekekeks deleted the win32-sync-context-fix branch July 15, 2020 07:23
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