This repository was archived by the owner on Feb 2, 2021. It is now read-only.
Fix leaking handlers for iOS device logs #1022
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In case iOS Device is detached, the
IOSDeviceinstance is kept alive. The reason is the handler for device logs, thatIOSDevicepasses toiOSDeviceOperations.As
iOSDeviceOperationsis still alive, theIOSDeviceinstance is also alive. Reattaching the same device will cause duplicate logs. Detaching and attaching it again will lead to additional logs.In order to fix the issue, convert
iOSDeviceOpertationsto event emitter and emit event when there's data for logging. EachIOSDevicewill add handler for the event and will do its logic.In case device is detached (i.e.
DeviceLostevent is fired inDevicesService), call a newly added method to the specificIDeviceinstance. It's purpose is to clean the used resource.For iOS device, this method will remove the handler for
devceLogDataevent ofiOSDeviceOperations.