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 quickly adding/removing tabs in switcher #2760

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

dus7
Copy link
Contributor

@dus7 dus7 commented Apr 17, 2024

Task/Issue URL: https://app.asana.com/0/414235014887631/1204624719960838/f
Tech Design URL:
CC:

Description:

This PR prevents internal inconsistency during CollectionView updates by not allowing to add a tab to model during batch updates execution block.

Steps to test this PR:

  1. Go to Tab Switcher
  2. Make sure there are at least two tabs
  3. Drag tab to delete and immediately try to add a new tab
  4. Attempt similar scenario with keyboard shortcuts (cmd+n)

Internal references:

Software Engineering Expectations
Technical Design Template

@dus7 dus7 changed the title mariusz/fix collection view crash Fix crash when quickly adding/removing tabs in switcher Apr 17, 2024
@@ -123,12 +123,12 @@ class TabViewCell: UICollectionViewCell {
}

private func startRemoveAnimation() {
self.isDeleting = true
self.deleteTab()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This allows for shorter delay before adding a tab is again possible. Based on my checks it does not interfere with animations. Once this function is called, the gesture is committed anyway.

@dus7 dus7 marked this pull request as ready for review April 17, 2024 13:14
@aataraxiaa aataraxiaa self-requested a review April 17, 2024 13:22
Copy link
Contributor

@aataraxiaa aataraxiaa left a comment

Choose a reason for hiding this comment

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

Tested and LGTM 🚀

@dus7 dus7 linked an issue Apr 17, 2024 that may be closed by this pull request
@dus7 dus7 merged commit 2dec39a into release/7.116.0 Apr 17, 2024
33 checks passed
@dus7 dus7 deleted the mariusz/fix-collection-view-crash branch April 17, 2024 14:26
samsymons added a commit that referenced this pull request Apr 18, 2024
* main:
  Release 7.116.0-1 (#2761)
  Remove validator app (#2754)
  Fix crash when quickly adding/removing tabs in switcher (#2760)
  Fix settings navigation bar colors after reopening (#2758)
  Alpha ad-hoc lane (#2492)
  Keep a weak reference to UserScriptMessageBroker (#2755)
  Add refresh config cell to top of debug (#2735)
  VPN: Replace available interfaces in VPN metadata (#2750)
  Require device auth to be set in order to use Sync (#2722)
  Add new iOS pixels for measuring navigation  (#2730)
  Privacy pro metadata updates (#2747)
  Update autoconsent to v10.6.1 (#2734)
  Limit Stale actions to issues (#2745)
  Change DAU pixel for VPN to weekly (#2684)
  Support Autofill Domains with Port Number Suffixes (#2715)
  Update secure vault error pixels to fire daily (#2557)
  Subscription: Fix 'Back' button not present (#2741)
  Subscription State improvements + Remove SUBSCRIPTION Flag (#2726)
  Release 7.116.0-0 (#2739)
  Release 7.116.0-0 (#2737)
samsymons added a commit that referenced this pull request Apr 20, 2024
# By Daniel Bernal (11) and others
# Via Mariusz Śpiewak (3) and others
* main: (63 commits)
  Release 7.115.1-1 (#2770)
  Fix iOS auto-clearing fails to remove cookies (#2769)
  Release 7.115.1-0 (#2768)
  Fix iOS auto-clearing fails to remove cookies (#2767)
  iOS: VPN screen improvements (#2721)
  Release 7.116.0-2 (#2763)
  Remove "Thank You" prompt (#2762)
  Test to ensure that page refresh doesn't affect url bar focus (#2749)
  Add support for uploading crash reports to Sentry (#2720)
  Replace SwiftLintPlugin with SwiftLintTool (#2710)
  Release 7.116.0-1 (#2761)
  Remove validator app (#2754)
  Fix crash when quickly adding/removing tabs in switcher (#2760)
  Fix settings navigation bar colors after reopening (#2758)
  Alpha ad-hoc lane (#2492)
  Keep a weak reference to UserScriptMessageBroker (#2755)
  Add refresh config cell to top of debug (#2735)
  VPN: Replace available interfaces in VPN metadata (#2750)
  Require device auth to be set in order to use Sync (#2722)
  Add new iOS pixels for measuring navigation  (#2730)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo/AppDelegate.swift
#	DuckDuckGo/MainViewController.swift
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.

[Bug] Swiping to close tab and quickly clicking new tab causes crash
2 participants