Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove Unnecessary Synchronize in Dealloc #169

Merged

Conversation

BrandonStalnaker
Copy link
Contributor

@BrandonStalnaker BrandonStalnaker commented Nov 28, 2022

Summary

Inspected all uses of dealloc method

MPApplication
Removed as synchronize has been unneeded since iOS 7

MPBackendController

Our in-app documentation provides full reasoning for this code as it supports our proxying of the app delegate.

MPSegment
Apple Docs ("A typical pattern is to register as an observer during the observer’s initialization (for example in init or viewDidLoad) and unregister during deallocation (usually in dealloc)") actually suggest including your removeObserver code in the dealloc: method. Adding the observer doesn’t cause a retain on the class object and using instruments I wasn’t able to find any leaks. If you have a .trace recorded from instruments showing it, that would be a huge help.

MParticleReachability & MPStateMachine by extension
This is the standard shared reachability code written by Apple used across multiple organizations. I agree we should update to the swift version when we update fully to Swift but for now it is appropriate to use.

Testing Plan

Ran through unit tests and putting code through its paces in a sample application. Also tested for leaks through instruments.

Master Issue

Closes https://mparticle-eng.atlassian.net/browse/SQDSDKS-4831

@BrandonStalnaker BrandonStalnaker self-assigned this Nov 28, 2022
@BrandonStalnaker BrandonStalnaker changed the base branch from main to development November 28, 2022 14:44
Copy link
Contributor

@einsteinx2 einsteinx2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BrandonStalnaker BrandonStalnaker merged commit 83abf8e into development Nov 28, 2022
@BrandonStalnaker BrandonStalnaker deleted the fix/Remove-Unnecessary-Synchronize-In-Dealloc branch November 28, 2022 17:02
mparticle-automation added a commit that referenced this pull request Nov 30, 2022
# [8.9.0](v8.8.1...v8.9.0) (2022-11-30)

### Bug Fixes

* Add class checks to initialize methods ([#165](#165)) ([065df46](065df46))
* Add Hash Methods where isEqual called ([#167](#167)) ([7302e0d](7302e0d))
* Allow null event attributes ([#163](#163)) ([5fd25c6](5fd25c6))
* Move dyld register callback to initialize ([#170](#170)) ([49d3660](49d3660))
* Remove unnecessary calls to removeObserver ([#168](#168)) ([a288ba4](a288ba4))
* Remove Unnecessary Synchronize in Dealloc ([#169](#169)) ([624891b](624891b))

### Features

* match android type support for custom attributes ([#157](#157)) ([c9a34cd](c9a34cd))
* Remove depreciate MPSegment code ([#171](#171)) ([1c04262](1c04262))
* Update Sample App for iOS 16 ([#158](#158)) ([fed8131](fed8131))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants