Skip to content

fix: Don't cancel a FLAC download on a navigation back#1870

Open
BaptGrv wants to merge 1 commit intomasterfrom
fix/download-flac
Open

fix: Don't cancel a FLAC download on a navigation back#1870
BaptGrv wants to merge 1 commit intomasterfrom
fix/download-flac

Conversation

@BaptGrv
Copy link
Copy Markdown
Contributor

@BaptGrv BaptGrv commented Apr 2, 2026

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 2, 2026

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential Memory Leak

Removing currentDownloadOperation?.cancel() may cause the view controller to be retained by the ongoing download operation if the operation holds strong references to self (via delegates or completion closures). This would prevent the view controller from being deallocated until the download completes, wasting memory. If the download is intended to continue in the background after the user navigates back, consider transferring ownership to a separate download manager that outlives the view controller rather than keeping it as a property of this view controller.

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    navigationController?.navigationBar.transform = .identity
    let currentCell = (collectionView.cellForItem(at: currentIndex) as? PreviewCollectionViewCell)
    currentCell?.didEndDisplaying()
    previewErrors.values.compactMap { $0 as? OfficePreviewError }.forEach { $0.downloadTask?.cancel() }

    UIApplication.shared.endReceivingRemoteControlEvents()
    resignFirstResponder()

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant