SSSnackbar icon indicating copy to clipboard operation
SSSnackbar copied to clipboard

Crash on quickly presenting / dismissing / re-presenting...

Open adamjack opened this issue 7 years ago • 0 comments

I have a snackbar show on a modal view controller, it was meant to provide a heads up (with an action) on initial view. I find that if I present the VC but quick (during testing) drop it, and re-raise it, I get a crash. It appears to be attempting to clear up the previous snackbar, which I assume (from the crash) has been deallocated.

  • (void)dismissAnimated:(BOOL)animated { [self invalidateTimer]; [self.superview removeConstraints:self.visibleVerticalLayoutConstraints]; [self.superview addConstraints:self.hiddenVerticalLayoutConstraints]; currentlyVisibleSnackbar = nil;

    if (!animated) { if (!self.actionBlockDispatched) <--- Crashes here... [self executeDismissalBlock]; [self removeFromSuperview]; }

called from show:

       [currentlyVisibleSnackbar dismissAnimated:NO];

I am using this from Swift, and my Objective C is already getting rusty, but I wonder if this should be __weak so it nils on cleanup?

   static SSSnackbar *currentlyVisibleSnackbar = nil;

adamjack avatar Aug 05 '17 00:08 adamjack