SSSnackbar icon indicating copy to clipboard operation
SSSnackbar copied to clipboard

Snackbar on main VC, then Snackbar on modal VC, crash on cleanup as returns to main VC

Open adamjack opened this issue 7 years ago • 0 comments

I've had a pretty awkward to debug (i.e. no useful stack trace) issue which I think I've tracked down to my usage SSSnackbar. I love the view, I like how it allows me to message the user w/o getting in the way, so I use it a lot. I'd not put two and two together, at first, but I have this:

  • Main view does a SSSnackbar on startup of VC saying something.
  • Optionally a user presents a modal view (on iPhone, over whole window) and that VC uses a SSSnackbar to message.
  • If the user exits the modal before the second SSSnackbar is done (I think this is important) and returns to the main view (that raises a snackbar) then the app crashes on the code to cleanup the SSSnackbar.

I know I'll get a little less snackbar happy (it was just initial code and I'd not realized how it works in reality) but I think this is the issue:

  • Modal creates a SSSnackbar (so a different VC hierarchy?)
  • Modal goes away (tearing down SSSnackbar but it not clearing currentlyVisibleSnackbar)
  • Main VC tries to show and tries to replace existing SSSnackbar, but crashes on accessing currentlyVisibleSnackbar.

Even though my case might be a bit noisy, I can imagine this scenario occurring in some cases (where user is bounding around.)

Any thoughts on how to debug this, and what the best approach to fix this is? I know there have been tweaks / fixes for the modal VC hierarchy before, and wonder if another is possible / needed.

Thanks in advance, and I can supply more details if needed.

adamjack avatar May 05 '17 15:05 adamjack