From 1a7c530e21c8c35f5a29452636d7317c859e645a Mon Sep 17 00:00:00 2001 From: Jeremy Chiang Date: Fri, 5 Apr 2019 16:13:59 -0700 Subject: [PATCH] Fix disconnect then scan crash (#203) * Fix crashes when a queueable needs to fail due to a queued disconnection, #196 Failing a queueable requires updating a queue, and therefore requires a reference to the queue. The disconnection queued failure block is relatively new, so I didn't catch the new requirement to shuffle the queue assignment to the new starting point of the add call. * Bump version to 0.8.4, #196 --- Bluejay.podspec | 4 ++-- Bluejay/.jazzy.yaml | 2 +- Bluejay/Bluejay/Info.plist | 2 +- Bluejay/Bluejay/Queue.swift | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Bluejay.podspec b/Bluejay.podspec index aa0e763..573a936 100644 --- a/Bluejay.podspec +++ b/Bluejay.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |spec| spec.name = 'Bluejay' - spec.version = '0.8.3' + spec.version = '0.8.4' spec.license = { type: 'MIT', file: 'LICENSE' } spec.homepage = 'https://github.com/steamclock/bluejay' spec.authors = { 'Jeremy Chiang' => 'jeremy@steamclock.com' } spec.summary = 'Bluejay is a simple Swift framework for building reliable Bluetooth apps.' spec.homepage = 'https://github.com/steamclock/bluejay' - spec.source = { git: 'https://github.com/steamclock/bluejay.git', tag: 'v0.8.3' } + spec.source = { git: 'https://github.com/steamclock/bluejay.git', tag: 'v0.8.4' } spec.source_files = 'Bluejay/Bluejay/*.{h,swift}' spec.framework = 'SystemConfiguration' spec.platform = :ios, '10.0' diff --git a/Bluejay/.jazzy.yaml b/Bluejay/.jazzy.yaml index ab48a0f..8f13e71 100644 --- a/Bluejay/.jazzy.yaml +++ b/Bluejay/.jazzy.yaml @@ -2,7 +2,7 @@ output: ../docs author: Steamclock Software author_url: http://steamclock.com module: Bluejay -module_version: 0.8.3 +module_version: 0.8.4 readme: ../README.md sdk: iphone copyright: Copyright © 2017 Steamclock Software. All rights reserved. diff --git a/Bluejay/Bluejay/Info.plist b/Bluejay/Bluejay/Info.plist index fd19e2c..dc240f5 100644 --- a/Bluejay/Bluejay/Info.plist +++ b/Bluejay/Bluejay/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.8.3 + 0.8.4 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSPrincipalClass diff --git a/Bluejay/Bluejay/Queue.swift b/Bluejay/Bluejay/Queue.swift index 358f7b8..5ec3dd6 100644 --- a/Bluejay/Bluejay/Queue.swift +++ b/Bluejay/Bluejay/Queue.swift @@ -55,12 +55,13 @@ class Queue { preconditionFailure("Cannot enqueue: Bluejay instance is nil.") } + queueable.queue = self + if isDisconnectionQueued { queueable.fail(BluejayError.disconnectQueued) return } - queueable.queue = self queue.append(queueable) /*