Skip to content
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

Fix LayoutUpdated and EffectiveViewportChanged double registration #17196

Conversation

MrJul
Copy link
Member

@MrJul MrJul commented Oct 4, 2024

What does the pull request do?

This PR ensures that Layoutable events LayoutUpdated and EffectiveViewportChanged aren't subscribed twice if they are registered in OnAttachedToVisualTree() or the AttachedToVisualTree event.

Unit tests have been added.

What is the current behavior?

Subscribing to LayoutUpdated or EffectiveViewportChanged while inside OnAttachedToVisualTree effectively adds the handler twice to the underlying LayoutManager.

What is the updated/expected behavior with this PR?

The handler is added only once to LayoutManager.

@MrJul MrJul added bug backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Oct 4, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0052401-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul enabled auto-merge October 7, 2024 11:07
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0052433-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.3.999-cibuild0052453-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added this pull request to the merge queue Oct 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 7, 2024
@maxkatz6 maxkatz6 merged commit 51dbf95 into AvaloniaUI:master Oct 7, 2024
10 checks passed
maxkatz6 pushed a commit that referenced this pull request Oct 27, 2024
…17196)

* Add failing test for LayoutUpdated and EffectiveViewportChanged

* Fix LayoutUpdated and EffectiveViewportChanged registration
@maxkatz6 maxkatz6 added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants