Skip to content

Commit 670cb7c

Browse files
Vetle444Copilot
andauthored
Fix critical modal page leak on Android, and several other small memory leaks (#818)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 33bfbcb commit 670cb7c

32 files changed

Lines changed: 589 additions & 27 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [55.2.7]
2+
- [Android][Modal] Fixed memory leak when popping modal pages wrapped in NavigationPage, caused by StackNavigationManager not clearing references on disconnect (dotnet/maui#34456)
3+
- [Android][Button] Fixed memory leak caused by strong reference from platform MaterialButton to virtual Button
4+
- [Android][SearchBar] Fixed memory leak caused by bindings and event handlers not being cleaned up on disconnect
5+
- [iOS][SearchBar] Fixed incorrect event unsubscription (SearchButtonClicked was unsubscribed as CancelButtonClicked)
6+
17
## [55.2.6]
28
- [ContextMenu] Fixed that in some cases context menu never appears when tapping.
39

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using DIPS.Mobile.UI.Components.Loading;
2+
using ActivityIndicator = DIPS.Mobile.UI.Components.Loading.ActivityIndicator;
3+
4+
namespace MemoryLeakTests.Tests;
5+
6+
public class ActivityIndicatorTest : UITest
7+
{
8+
public override void BeforeTest(ContentPage contentPage)
9+
{
10+
contentPage.Content = new ActivityIndicator { IsRunning = true };
11+
}
12+
13+
public override string Name => "ActivityIndicator";
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Button = DIPS.Mobile.UI.Components.Buttons.Button;
2+
3+
namespace MemoryLeakTests.Tests;
4+
5+
public class ButtonTest : UITest
6+
{
7+
public override void BeforeTest(ContentPage contentPage)
8+
{
9+
contentPage.Content = new Button { Text = "Button", Command = new Command(() => { }) };
10+
}
11+
12+
public override string Name => "Button";
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using DIPS.Mobile.UI.Components.Chips;
2+
3+
namespace MemoryLeakTests.Tests;
4+
5+
public class ChipTest : UITest
6+
{
7+
public override void BeforeTest(ContentPage contentPage)
8+
{
9+
contentPage.Content = new Chip { Title = "Chip", Command = new Command(() => { }) };
10+
}
11+
12+
public override string Name => "Chip";
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using DIPS.Mobile.UI.Components.Labels;
2+
using CollectionView = DIPS.Mobile.UI.Components.Lists.CollectionView;
3+
using Label = DIPS.Mobile.UI.Components.Labels.Label;
4+
5+
namespace MemoryLeakTests.Tests;
6+
7+
public class CollectionViewTest : UITest
8+
{
9+
public override void BeforeTest(ContentPage contentPage)
10+
{
11+
var collectionView = new CollectionView
12+
{
13+
ItemsSource = new List<string> { "Item 1", "Item 2", "Item 3" },
14+
ItemTemplate = new DataTemplate(() => new Label { Text = "Item" })
15+
};
16+
17+
contentPage.Content = collectionView;
18+
}
19+
20+
public override string Name => "CollectionView";
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Editor = DIPS.Mobile.UI.Components.TextFields.Editor.Editor;
2+
3+
namespace MemoryLeakTests.Tests;
4+
5+
public class EditorTest : UITest
6+
{
7+
public override void BeforeTest(ContentPage contentPage)
8+
{
9+
contentPage.Content = new VerticalStackLayout
10+
{
11+
Children =
12+
{
13+
new Editor { Placeholder = "Editor 1" },
14+
new Editor { Placeholder = "Editor 2" }
15+
}
16+
};
17+
}
18+
19+
public override string Name => "Editor";
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Entry = DIPS.Mobile.UI.Components.TextFields.Entry.Entry;
2+
3+
namespace MemoryLeakTests.Tests;
4+
5+
public class EntryTest : UITest
6+
{
7+
public override void BeforeTest(ContentPage contentPage)
8+
{
9+
contentPage.Content = new VerticalStackLayout
10+
{
11+
Children =
12+
{
13+
new Entry { Placeholder = "Entry 1" },
14+
new Entry { Placeholder = "Entry 2" }
15+
}
16+
};
17+
}
18+
19+
public override string Name => "Entry";
20+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using DIPS.Mobile.UI.Components.Images;
2+
using DIPS.Mobile.UI.Resources.Icons;
3+
using Image = DIPS.Mobile.UI.Components.Images.Image;
4+
5+
namespace MemoryLeakTests.Tests;
6+
7+
public class ImageTest : UITest
8+
{
9+
public override void BeforeTest(ContentPage contentPage)
10+
{
11+
contentPage.Content = new VerticalStackLayout
12+
{
13+
Children =
14+
{
15+
new Image.Image { Source = Icons.GetIcon(IconName.check_line) },
16+
new ImageButton { Source = Icons.GetIcon(IconName.close_line) }
17+
}
18+
};
19+
}
20+
21+
public override string Name => "Image";
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using DIPS.Mobile.UI.Components.TextFields.InputFields;
2+
using DIPS.Mobile.UI.Components.TextFields.InputFields.MultiLineInputField;
3+
4+
namespace MemoryLeakTests.Tests;
5+
6+
public class InputFieldTest : UITest
7+
{
8+
public override void BeforeTest(ContentPage contentPage)
9+
{
10+
contentPage.Content = new VerticalStackLayout
11+
{
12+
Children =
13+
{
14+
new SingleLineInputField { HeaderText = "Single line" },
15+
new MultiLineInputField { HeaderText = "Multi line" }
16+
}
17+
};
18+
}
19+
20+
public override string Name => "InputFields";
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using DIPS.Mobile.UI.Components.Labels;
2+
using Label = DIPS.Mobile.UI.Components.Labels.Label;
3+
4+
namespace MemoryLeakTests.Tests;
5+
6+
public class LabelTest : UITest
7+
{
8+
public override void BeforeTest(ContentPage contentPage)
9+
{
10+
contentPage.Content = new Label { Text = "Label" };
11+
}
12+
13+
public override string Name => "Label";
14+
}

0 commit comments

Comments
 (0)