-
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
[macOS] Fix crash when setting window properties #21357
[macOS] Fix crash when setting window properties #21357
Conversation
Hey there @MartyIX! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
cc @mattleibow because of his work on #16637. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
3ad3310
to
1ebaaa0
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@mattleibow Could you please take a look? |
@rmarinho @mattleibow Feedback would be greatly appreaciated on this one. |
@@ -198,6 +198,10 @@ public double MinimumHeight | |||
return ValidatePositive(coord); | |||
} | |||
|
|||
#if MACCATALYST | |||
bool _frameUpdateInProgress = false; |
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.
Is there a way to use the _batchFrameUpdate
field? That is already being set when the frame is updating.
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.
I'll try if it works.
if (_frameUpdateInProgress) { | ||
X = frame.X; | ||
Y = frame.Y; | ||
Width = frame.Width; | ||
Height = frame.Height; | ||
|
||
return; | ||
} |
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.
What is the difference between setting this and using SetValueCore
?
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.
I can't recall specifically but I think it was that SetValueCore
lead to a crash precisely because it leads to an infinite loop:
platformWindow.UpdateUnsupportedCoordinate(window); |
Does it make sense to you? I can try to dig into it again if that doesn't sound right but I don't have a solid grasp of SetValueCore
so a little explanation of what it is supposed to would be very welcome.
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.
SetValueCore
updates the property value, but you are also setting Height
which should also update the property. If there is a loop, maybe there is a bug in the "unused" logic - or maybe something should not be updating...
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.
Hm, my VS Code on macOS got totally broken, I can't debug MAUI projects anymore.
Anyway, I think it's good to put a breakpoint on L217 to see the stacktrace there and if this PR makes sense or not.
I'll try to work on this PR later. I spent 2 hours and I couldn't get that stacktrace. I'm out of time for now.
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.
I think I got bitten by #22033.
Description of Change
I'm not really sure if the approach of the patch is correct. It's the only one I could make as I don't understand details here.
Feedback is welcome.
See #21306 (comment) for an explanation of the bug.
Issues Fixed
Fixes #21306