Skip to content

Commit ab4993a

Browse files
committed
Memory leakage on modus controls #452
1 parent 007dc8b commit ab4993a

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Trimble.Modus.Components.Popup.Services;
55

66
namespace Trimble.Modus.Components;
7-
public partial class TMDropDown : ContentView, IDisposable
7+
public partial class TMDropDown : ContentView
88
{
99
#region Private fields
1010
private double desiredHeight;
@@ -136,6 +136,7 @@ public TMDropDown()
136136
InitializeComponent();
137137
this.SetDynamicResource(StyleProperty, "DefaultStyle");
138138
PopupService.Instance.Dismissed += OnPopupRemoved;
139+
this.Unloaded += OnUnloaded;
139140
}
140141
#endregion
141142

@@ -383,8 +384,16 @@ protected override void OnHandlerChanged()
383384
public void Dispose()
384385
{
385386
PopupService.Instance.Dismissed -= OnPopupRemoved;
387+
this.Unloaded -= OnUnloaded;
386388
SelectionChanged = null;
387389
SelectionChangedCommand = null;
388390
ItemsSource = null;
391+
dropDownContents = null;
392+
previousSelection = null;
393+
}
394+
395+
private void OnUnloaded(object sender, EventArgs e)
396+
{
397+
Dispose();
389398
}
390399
}

Trimble.Modus.Components/Trimble.Modus.Components.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2828
<PackageId>Trimble.Modus.Components</PackageId>
2929
<Title>Trimble Modus</Title>
30-
<Version>1.4.0</Version>
30+
<Version>1.4.0.1</Version>
3131
<Authors>Trimble Inc</Authors>
3232
<Company>Trimble Inc</Company>
3333
<Product>Trimble.Modus.Components</Product>

0 commit comments

Comments
 (0)