Skip to content

fix: XamlRoot may be null when the SKXamlCanvas is unloaded - #2854

Merged
mattleibow merged 4 commits into
mono:mainfrom
jeromelaban:dev/jela/winui-xamlroot
Jun 3, 2024
Merged

mattleibow merged 4 commits into
mono:mainfrom
jeromelaban:dev/jela/winui-xamlroot

Conversation

@jeromelaban

Copy link
Copy Markdown
Contributor

Description of Change

Avoids an NRE when using a null XamlRoot on WinUI when the control is unloading.

API Changes

None.

Behavioral Changes

None.

Required skia PR

None.

@jeromelaban

Copy link
Copy Markdown
Contributor Author

@mattleibow could it be possible to backport this one to 2.88? Thanks!

@jdobelstein-kahua jdobelstein-kahua left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

jeromelaban is a null check in on the root.Invalidate call needed for the same reason? Couldn't hurt.

@jeromelaban

Copy link
Copy Markdown
Contributor Author

jeromelaban is a null check in on the root.Invalidate call needed for the same reason? Couldn't hurt.

That's fair. I ignored that particular site because the XamlRoot.Changed event is called only when XamlRoot is set, but indeed, it does not hurt.

@mattleibow mattleibow added the backport/release/2.x Backport this PR to release/2.x label Jun 3, 2024
@mattleibow
mattleibow merged commit 8e7a51d into mono:main Jun 3, 2024
github-actions Bot pushed a commit that referenced this pull request Jun 3, 2024
* fix: XamlRoot may be null when the SKXamlCanvas is unloaded

* chore: Adjust more xamlroot uses

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
(cherry picked from commit 8e7a51d)
@jeromelaban
jeromelaban deleted the dev/jela/winui-xamlroot branch June 3, 2024 14:28
mattleibow pushed a commit that referenced this pull request Jun 18, 2024
…2884)

* fix: XamlRoot may be null when the SKXamlCanvas is unloaded

* chore: Adjust more xamlroot uses

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
(cherry picked from commit 8e7a51d)

Co-authored-by: Jérôme Laban <jlaban@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/release/2.x Backport this PR to release/2.x community ✨

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants