Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some small questions and comments
if (disposing && !_disposed) { | ||
_disposed = true; | ||
if (_disposed) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could drop { here
if (mapModel != null) { | ||
MessagingCenter.Unsubscribe<Map, MapSpan> (this, MoveMessageName); | ||
((ObservableCollection<Pin>)mapModel.Pins).CollectionChanged -= OnCollectionChanged; | ||
if (disposing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !disposing return ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't return right here, still need to call base.Dispose(disposing)
.
} | ||
// We do *not* eagerly dispose of the _pageContainer here; doing so causes a memory leak | ||
// if animated fragment transitions are enabled (it removes some info that the animation's | ||
// onAnimationEnd handler requires to properly clean things up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OHHH
{ | ||
tcs.TrySetResult(true); | ||
fragment.UserVisibleHint = true; | ||
fragment.UserVisibleHint = !removed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does remove get set? after animation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's one of the parameters to SwitchContentAsync
(the method we're in right now).
NativeMap.MyLocationEnabled = false; | ||
NativeMap.SetOnCameraChangeListener(null); | ||
NativeMap.InfoWindowClick -= MapOnMarkerClick; | ||
NativeMap.Dispose(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NativeMap = null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NativeMap
refers to MapView.Map
, which is read-only.
Control.RemoveOnAttachStateChangeListener(this); | ||
Control.Tag = null; | ||
_textColorSwitcher = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Control = null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not here. The base class ViewRenderer<TView, TNativeView>
still has some cleanup to do on Control
, then it gets set to null
.
((ObservableCollection<Pin>)mapModel.Pins).CollectionChanged -= OnCollectionChanged; | ||
if (disposing) | ||
{ | ||
_disposed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed. This is already done above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
Needs rebase |
Clean up OnFocusChangeListener on ViewRenderer during disposal Prevent memory leak of PageContainer/FragmentContainer when animating fragment transitions Call Destroy() on Map during disposal Rebasing
18d418c
to
0047e9f
Compare
Description of Change
Fixes for several memory leaks on Android. Changes include:
Bugs Fixed
API Changes
None
Behavioral Changes
None
PR Checklist