-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
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. |
WM_PAINT still has to trigger a repaint since it's being sent in certain situations when window contents are lost |
Some reference material back from WinXP times https://docs.microsoft.com/en-us/archive/blogs/cbrumme/apartments-and-pumping-in-the-clr |
@kekekeks If I remember correctly - your plan was to add message polling for certain scenarios? Or we want to disable all messages? |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We can't trust our locks otherwise: https://stackoverflow.com/questions/4540244/how-is-this-possible-onpaint-processed-while-in-waitone/4540745#4540745