-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 retain cycles in Site Creation #21066
Conversation
@@ -20,7 +20,7 @@ class TemplatePreviewViewController: UIViewController, NoResultsViewHost, UIPopo | |||
@IBOutlet weak var footerView: UIView! | |||
@IBOutlet weak var progressBar: UIProgressView! | |||
|
|||
internal var delegate: TemplatePreviewViewDelegate? | |||
internal weak var delegate: TemplatePreviewViewDelegate? |
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.
LayoutPreviewViewController
retains self: delegate = self
Lines 3 to 11 in 48b8a39
class LayoutPreviewViewController: TemplatePreviewViewController { | |
let completion: PageCoordinator.TemplateSelectionCompletion | |
let layout: PageTemplateLayout | |
init(layout: PageTemplateLayout, selectedPreviewDevice: PreviewDevice?, onDismissWithDeviceSelected: ((PreviewDevice) -> ())?, completion: @escaping PageCoordinator.TemplateSelectionCompletion) { | |
self.layout = layout | |
self.completion = completion | |
super.init(demoURL: layout.demoUrl, selectedPreviewDevice: selectedPreviewDevice, onDismissWithDeviceSelected: onDismissWithDeviceSelected) | |
delegate = self |
@@ -8,7 +8,7 @@ final class SiteSegmentsStep: WizardStep { | |||
return SiteSegmentsWizardContent(service: self.service, selection: self.didSelect) | |||
}() | |||
|
|||
var delegate: WizardDelegate? | |||
weak var delegate: WizardDelegate? |
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.
A retain cycle between WizardNavigation
and SiteSegmentsStep
WordPress-iOS/WordPress/Classes/ViewRelated/Site Creation/Wizard/WizardNavigation.swift
Lines 47 to 51 in 48b8a39
private func configureSteps() { | |
for var step in steps { | |
step.delegate = self | |
} | |
} |
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
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.
The code changes look good.
- Wizard delegate during side creation continues to be working ✅
- TemplatePreview delegate during page creation continues to be working ✅
Relates to #21050.
I'll add PR comments regarding the two retain cycles.
Regression Notes
Potential unintended areas of impact
None.
What I did to test those areas of impact (or what existing automated tests I relied on)
None.
What automated tests I added (or what prevented me from doing so)
None.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: N/A