Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
private var hasEditorStarted = false
private var isModalDialogOpen = false

lazy var autosaver = Autosaver() {
self.performAutoSave()
lazy var autosaver = Autosaver() { [weak self] in
self?.performAutoSave()
}

// MARK: - Private Properties
Expand Down Expand Up @@ -197,6 +197,14 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor

deinit {
tearDownKeyboardObservers()

// Cancel any pending tasks
editorLoadingTask?.cancel()
Copy link
Contributor

Choose a reason for hiding this comment

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

This line won't do anything because editorLoadingTask retains self, so there is no way deinit can get called before the task finishes.


// Clean up child view controller
editorViewController.willMove(toParent: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a no-op as it happens automatically when the parent is removed.

editorViewController.view.removeFromSuperview()
editorViewController.removeFromParent()
}

// MARK: - Lifecycle methods
Expand Down