Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
26fabcd4
Unverified
Commit
26fabcd4
authored
May 21, 2020
by
Stonekity
Committed by
GitHub
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix memory leak of android view (#50111)
parent
e92afc16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
platform_views.dart
packages/flutter/lib/src/services/platform_views.dart
+1
-0
platform_views_test.dart
packages/flutter/test/services/platform_views_test.dart
+17
-0
No files found.
packages/flutter/lib/src/services/platform_views.dart
View file @
26fabcd4
...
...
@@ -532,6 +532,7 @@ class AndroidViewController {
await
SystemChannels
.
platform_views
.
invokeMethod
<
void
>(
'dispose'
,
id
);
_platformViewCreatedCallbacks
.
clear
();
_state
=
_AndroidViewState
.
disposed
;
PlatformViewsService
.
_instance
.
_focusCallbacks
.
remove
(
id
);
}
/// Sizes the Android View.
...
...
packages/flutter/test/services/platform_views_test.dart
View file @
26fabcd4
...
...
@@ -85,6 +85,23 @@ void main() {
await
viewController
.
dispose
();
});
test
(
'dispose clears focusCallbacks'
,
()
async
{
bool
didFocus
=
false
;
viewsController
.
registerViewType
(
'webview'
);
final
AndroidViewController
viewController
=
PlatformViewsService
.
initAndroidView
(
id:
0
,
viewType:
'webview'
,
layoutDirection:
TextDirection
.
ltr
,
onFocus:
()
{
didFocus
=
true
;
}
);
await
viewController
.
setSize
(
const
Size
(
100.0
,
100.0
));
await
viewController
.
dispose
();
final
ByteData
message
=
SystemChannels
.
platform_views
.
codec
.
encodeMethodCall
(
const
MethodCall
(
'viewFocused'
,
0
));
await
SystemChannels
.
platform_views
.
binaryMessenger
.
handlePlatformMessage
(
SystemChannels
.
platform_views
.
name
,
message
,
(
_
)
{
});
expect
(
didFocus
,
isFalse
);
});
test
(
'resize Android view'
,
()
async
{
viewsController
.
registerViewType
(
'webview'
);
await
PlatformViewsService
.
initAndroidView
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment