alexisakers / BulletinBoard

General-purpose contextual cards for iOS
MIT License
5.38k stars 304 forks source link

Calling dismissBulletin whilst bulletin is dismissing causes crash #148

Open yusuftor opened 5 years ago

yusuftor commented 5 years ago

If I call bulletinManager.dismissBulletin(animated: true) when the bulletin has already been dismissed, it crashes saying BLTNItemManager must only be used from the main thread. If the dismissBulletin() function is called immediately after the manager has been dismissed, bulletinManager.isShowingBulletin is still true. There needs to be a check like "if the manager is no longer presenting, or is in the middle of dismissing, ignore the call to dismiss".

I'm using the latest version of BulletinBoard

kambala-decapitator commented 4 years ago

Also facing same issue. I believe the crash actually happens in assertIsPrepared() because we've already ensured that all dismiss calls occur on the main thread. And for testing I could reproduce it by executing 2 dismiss calls in a row.

I'm using the following solution:

  1. add system("sed -i '' -e 's/fileprivate var isPrepared/public fileprivate(set) var isPrepared/' Pods/BulletinBoard/Sources/BLTNItemManager.swift") to post_install hook in the Podfile

  2. before calling dismiss, check that manager.isPrepared == true