Repeat icon indicating copy to clipboard operation
Repeat copied to clipboard

Crashes from time to time on debouncer

Open Samback opened this issue 5 years ago • 2 comments

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 avatar Jan 14 '20 09:01 Samback

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.

Samback avatar Jan 14 '20 15:01 Samback

it's also happened to me. marked

guzhenhuaGitHub avatar Aug 23 '23 09:08 guzhenhuaGitHub