-
Notifications
You must be signed in to change notification settings - Fork 1.3k
WpfGfx: Mitigate RemoveChild crash #11465
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -320,6 +320,14 @@ CMilVisual::RemoveChild( | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!m_rgpChildren.Remove(pChild)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // We've seen a handful of Watson dumps where incoming child is already detached | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // from parent and about to be deleted by the next MilCmdChannelDeleteResource | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // command. There are no known repros. For now we'll pretend we processed it. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (pChild->GetParent() == NULL) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return S_OK; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+325
to
+330
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // command. There are no known repros. For now we'll pretend we processed it. | |
| if (pChild->GetParent() == NULL) | |
| { | |
| return S_OK; | |
| } | |
| // command. There are no known repros. For now we'll pretend we processed it | |
| // only if the child no longer has a parent. Any other parent state is a | |
| // programming error and should fail. | |
| CMilVisual *pParent = pChild->GetParent(); | |
| if (pParent == NULL) | |
| { | |
| return S_OK; | |
| } | |
| // If the child still has a parent at this point, then either: | |
| // - pParent == this: the child thinks it belongs to this visual but is | |
| // missing from m_rgpChildren, or | |
| // - pParent != this: the child belongs to a different visual. | |
| // Both represent inconsistent or invalid state and are treated as errors. | |
| if (pParent != this) | |
| { | |
| IFC(E_INVALIDARG); | |
| } |
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.
The comment references "Watson dumps" which is Microsoft's internal crash reporting system. Consider whether this terminology should be more generic for the open-source version of WPF, or if it should reference the specific issue number (Issue #11464) instead for better traceability.