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 crash when starting a request on an invalidated session #829

Open
wants to merge 2 commits into
base: wpios-edition
Choose a base branch
from

Conversation

kean
Copy link
Contributor

@kean kean commented Feb 3, 2025

Description

Fixes #

ℹ Please replace the above with a link to the issue this pull request addresses, as well as a summary of the implementation details.

Testing Details

ℹ Please replace this with a clear and concise description of the steps required to validate this pull request.


  • Please check here if your pull request includes additional test coverage.
  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

@kean kean force-pushed the fix/crash-on-invalidate branch 2 times, most recently from b187132 to df614dc Compare February 3, 2025 17:50
@kean kean force-pushed the fix/crash-on-invalidate branch from df614dc to fede7bd Compare February 3, 2025 17:57
@kean kean changed the base branch from trunk to wpios-edition February 3, 2025 18:09
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ Package.swift was changed without updating its corresponding Package.resolved. Please resolve the Swift packages in Xcode.

Generated by 🚫 Danger

@kean kean force-pushed the fix/crash-on-invalidate branch from a8c0029 to fede7bd Compare February 3, 2025 19:19
@kean kean changed the title Fix/crash on invalidate Fix crash when starting a request on an invalidated session Feb 3, 2025
@@ -105,6 +105,8 @@ open class WordPressComRestApi: NSObject {

private var useEphemeralSession: Bool

private var isInvalidated = false
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about changing those URLSession properties to Optional instead and assigning them to nil in the invalidateAndCancelTasks function?

@@ -202,6 +208,7 @@ open class WordPressComRestApi: NSObject {
success: @escaping SuccessResponseBlock,
failure: @escaping FailureReponseBlock) -> Progress? {
let progress = Progress.discreteProgress(totalUnitCount: 100)
print("GET:", Thread.callStackSymbols)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the print statements before merging.

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.

3 participants