diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2017-01-26 08:24:31 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-01-26 14:24:31 +0000 |
commit | 6b2a69d930d42657aff2b9ad769503b4939568ab (patch) | |
tree | e0b98e6ee63c0161a7e9cee69f285661e1685fb5 /Xamarin.Forms.Platform.iOS/Cells | |
parent | 6670ca58458582a1a670f97d17958220802f84b0 (diff) | |
download | xamarin-forms-6b2a69d930d42657aff2b9ad769503b4939568ab.tar.gz xamarin-forms-6b2a69d930d42657aff2b9ad769503b4939568ab.tar.bz2 xamarin-forms-6b2a69d930d42657aff2b9ad769503b4939568ab.zip |
[iOS/Critical] Fix ListView memory leaks (#524)
* fix memory leaks
added sample code
changed page name
Changed page title
add screen instructions
fix copy paste error
change subview dispose logic
Fix context action memory leak
add sample code
change custom page names
Revert "change custom page names"
This reverts commit 7aaab2625d9526080ca5c51c02e909f09ee3f610.
changed class names
changes
UI test for 32206
update ui test
fix whitespace
UITests done
* run UI tests on iOS only
* fix code style
* dispose prototype
* fix child renderer issue
* add null check
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Cells')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs | 18 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs | 16 |
2 files changed, 28 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs index e32e86cd..b42f69f4 100644 --- a/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs +++ b/Xamarin.Forms.Platform.iOS/Cells/CellTableViewCell.cs @@ -7,8 +7,8 @@ namespace Xamarin.Forms.Platform.iOS public class CellTableViewCell : UITableViewCell, INativeElementView { Cell _cell; - public Action<object, PropertyChangedEventArgs> PropertyChanged; + bool _disposed; public CellTableViewCell(UITableViewCellStyle style, string key) : base(style, key) { @@ -95,5 +95,21 @@ namespace Xamarin.Forms.Platform.iOS return nativeCell; } + + protected override void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + PropertyChanged = null; + _cell = null; + } + + _disposed = true; + + base.Dispose(disposing); + } } }
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs index 8f8a92ce..30c17234 100644 --- a/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Cells/ViewCellRenderer.cs @@ -48,9 +48,12 @@ namespace Xamarin.Forms.Platform.iOS internal class ViewTableCell : UITableViewCell, INativeElementView { WeakReference<IVisualElementRenderer> _rendererRef; - ViewCell _viewCell; + Element INativeElementView.Element => ViewCell; + internal bool SupressSeparator { get; set; } + bool _disposed; + public ViewTableCell(string key) : base(UITableViewCellStyle.Default, key) { } @@ -66,10 +69,6 @@ namespace Xamarin.Forms.Platform.iOS } } - Element INativeElementView.Element => ViewCell; - - internal bool SupressSeparator { get; set; } - public override void LayoutSubviews() { //This sets the content views frame. @@ -115,6 +114,9 @@ namespace Xamarin.Forms.Platform.iOS protected override void Dispose(bool disposing) { + if (_disposed) + return; + if (disposing) { IVisualElementRenderer renderer; @@ -126,8 +128,12 @@ namespace Xamarin.Forms.Platform.iOS _rendererRef = null; } + + _viewCell = null; } + _disposed = true; + base.Dispose(disposing); } |