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

Crashes from time to time on debouncer #45

Open
Samback opened this issue Jan 14, 2020 · 2 comments
Open

Crashes from time to time on debouncer #45

Samback opened this issue Jan 14, 2020 · 2 comments

Comments

@Samback
Copy link

Samback commented Jan 14, 2020

It happens unexpectedly from time to time on background and on foreground.
iOS 12 and iOS 13 on different iPhones versions.

3  Repeat                         0x10330c760 $s6Repeat8RepeaterC5reset_7restartyAC8IntervalOSg_SbtF + 196
4  Repeat                         0x10330a864 $s6Repeat9DebouncerC4call8newDelayyAA8RepeaterC8IntervalOSg_tF + 200

Or

3  Repeat                         0x103854a18 $s6Repeat8RepeaterC8setPause33_97E5396AC7E12D74879B993A593805A9LL4from2toSbAC5StateO_AItF + 168
4  Repeat                         0x103854cfc $s6Repeat8RepeaterC9timeFired33_97E5396AC7E12D74879B993A593805A9LLyyF + 628
5  Repeat                         0x10385676c $s6Repeat8RepeaterC14configureTimer33_97E5396AC7E12D74879B993A593805A9LLSo24OS_dispatch_source_timer_pyFyycfU_TA + 60
6  Repeat                         0x103852b60 $sIeg_IeyB_TR + 28
@Samback
Copy link
Author

Samback commented Jan 14, 2020

As I understand the problem is hide here

@discardableResult
	private func setPause(from currentState: State, to newState: State = .paused) -> Bool {
		guard self.state == currentState else {
			return false
		}

		self.timer?.suspend()
		self.state = newState

		return true
	}

And a specially on this field
self.timer?.suspend()

Based on previous research I have found an article that already helped you previously at #22 PR.
But I think we need one more step and add suspend and resume methods


    func resume() {
        if state == .resumed {
            return
        }
        state = .resumed
        timer.resume()
    }

    func suspend() {
        if state == .suspended {
            return
        }
        state = .suspended
        timer.suspend()
    }

I'll make a branch and gonna test this solution.

@guzhenhuaGitHub
Copy link

it's also happened to me. marked

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

No branches or pull requests

2 participants