Skip to content

Commit

Permalink
fix(TextBox): [iOS] Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 29, 2020
1 parent 623c02d commit cf7b2f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Windows.Foundation;
using Windows.UI.Core;
using Microsoft.Extensions.Logging;
using Uno.UI.DataBinding;

namespace Windows.UI.Xaml.Controls
{
Expand Down Expand Up @@ -101,7 +102,8 @@ private void InitializeProperties()

if (buttonRef != null)
{
buttonRef.Command = new DelegateCommand(DeleteText);
var thisRef = (this as IWeakReferenceProvider).WeakReference;
buttonRef.Command = new DelegateCommand(() => (thisRef.Target as TextBox)?.DeleteText());
}

InitializePropertiesPartial();
Expand Down

0 comments on commit cf7b2f0

Please sign in to comment.