MudCarousel: Fix timer creation after component disposal#11192
Merged
ScarletKuro merged 3 commits intoMudBlazor:devfrom Apr 14, 2025
Merged
Conversation
## Changes - added `_disposing` to keep track of disposed state - not creating timer if disposing is set to true ## Reason - If component is created, and then immediately destroyed, timer may still get created in OnAfterRenderAsync lifecycle hook, which would cause timer to be created after disposal, which in turn leads to memory leak
## Changes - added condition to not reset timer when disposing
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #11192 +/- ##
==========================================
- Coverage 91.08% 91.07% -0.01%
==========================================
Files 436 436
Lines 14110 14110
Branches 2731 2731
==========================================
- Hits 12852 12851 -1
Misses 640 640
- Partials 618 619 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ScarletKuro
approved these changes
Apr 14, 2025
|
This was referenced Aug 1, 2025
Closed
This was referenced Aug 14, 2025
This was referenced Aug 25, 2025
This was referenced Sep 3, 2025
This was referenced Sep 8, 2025
This was referenced Sep 22, 2025
This was referenced Oct 1, 2025
This was referenced Nov 12, 2025
This was referenced Dec 29, 2025
This was referenced Jan 9, 2026
This was referenced Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue
Found memory issues:





See the FromSeconds 5 which is referenced in the graph
Timer is sometimes created after dispose is called
Changes
_disposingto keep track of disposed stateReason
How Has This Been Tested?
Added Console.WriteLine when timer should be created or reset
Type of Changes
Checklist
dev).