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 a rare crash on featured image confirmation dialog #20836

Merged
merged 3 commits into from
May 18, 2024

Conversation

irfano
Copy link
Member

@irfano irfano commented May 16, 2024

This fixes some parts of #20535.

The crash message is "Can not perform this action after onSaveInstanceState" and occurs when attempting to show the featured image confirmation dialog after onSaveInstanceState has been called. This indicates that the code attempts to display the dialog even when the fragment is not active.

This PR adds a check to the fragment's state and doesn't run the code to show the dialog if the fragment's state is saved.


To Test:

I couldn't reproduce the crash. But follow the following items to test this change doesn't break anything.

  1. Log in and open Posts.
  2. Edit a post.
  3. Add an image block.
  4. Select the image block and tap the cog icon at the bottom bar.
  5. Tap "Set as featured image".
  6. Repeat 4-5.
  7. Ensure you see the featured image confirmation dialog as below.

Regression Notes

  1. Potential unintended areas of impact

    • None.
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    -N/A

  3. What automated tests I added (or what prevented me from doing so)

    • Since I can't reproduce it, I'm not adding any tests.

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@irfano irfano added this to the 25.0 milestone May 16, 2024
@irfano irfano requested a review from aditi-bhatia May 16, 2024 12:59
@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 16, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20836-b5bd863
Commitb5bd863
Direct Downloadjetpack-prototype-build-pr20836-b5bd863.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented May 16, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20836-b5bd863
Commitb5bd863
Direct Downloadwordpress-prototype-build-pr20836-b5bd863.apk
Note: Google Login is not supported on these builds.

@irfano irfano removed the request for review from aditi-bhatia May 16, 2024 13:28
@irfano irfano force-pushed the issue/20535-fix-crash-on-featured-image-dialog branch from 08b545a to 98eb43b Compare May 16, 2024 13:45
@irfano irfano requested a review from aditi-bhatia May 16, 2024 13:46
@irfano irfano force-pushed the issue/20535-fix-crash-on-featured-image-dialog branch from 98eb43b to 62250f0 Compare May 16, 2024 14:00
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@aditi-bhatia aditi-bhatia left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@aditi-bhatia aditi-bhatia merged commit 1987940 into trunk May 18, 2024
20 checks passed
@aditi-bhatia aditi-bhatia deleted the issue/20535-fix-crash-on-featured-image-dialog branch May 18, 2024 07:28
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.

IllegalStateException: Can not perform this action after onSaveInstanceState
3 participants