-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[C] avoid concurrent access to _values #24579
Conversation
0faebd1
to
2141468
Compare
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.
Just so the machines can stop nagging me about this PR, I think locking around the setting of the field is also worth doing just to make sure that there is no code path that also allows double setting.
Unless that is somehow impossible because of something else.
2141468
to
f50bac8
Compare
- should fix #23597
f50bac8
to
a3b0f4e
Compare
@@ -14,6 +14,8 @@ internal class SetterSpecificityList | |||
KeyValuePair<SetterSpecificity, object>? _second; | |||
SortedList<SetterSpecificity, object>? _values; | |||
|
|||
object _lock = new(); |
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.
Locks are typically readonly
.
I wonder why the lock is necessary in the first place. Is If access from multiple threads is expected, then why maui/src/Controls/src/Core/SetterSpecificityList.cs Lines 13 to 14 in a3b0f4e
|
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.
Seems this could help with the issue. Without a way to reproduce with a test is not easy to make sure it will actually work. But lets try
The original issue mentions #23597
My understanding is that Anyway, just my 50c. |
@MartyIX we agree that this shouldn't happen, if used correctly. but if this fix prevents a crash while the user abuses the API, it's worth it |
Issues Fixed