diff --git a/Source/ARTPush.m b/Source/ARTPush.m index 55af5dd73..3fb9688f9 100644 --- a/Source/ARTPush.m +++ b/Source/ARTPush.m @@ -79,7 +79,7 @@ - (void)deactivate { NSString *const ARTDeviceTokenKey = @"ARTDeviceToken"; @implementation ARTPushInternal { - ARTRestInternal *_rest; + __weak ARTRestInternal *_rest; // weak because rest owns self ARTLog *_logger; ARTPushActivationStateMachine *_activationMachine; } diff --git a/Source/ARTPushAdmin.m b/Source/ARTPushAdmin.m index 4a90900f2..35a569f0e 100644 --- a/Source/ARTPushAdmin.m +++ b/Source/ARTPushAdmin.m @@ -43,7 +43,7 @@ - (ARTPushChannelSubscriptions *)channelSubscriptions { @end @implementation ARTPushAdminInternal { - ARTRestInternal *_rest; + __weak ARTRestInternal *_rest; // weak because rest owns self ARTLog *_logger; dispatch_queue_t _userQueue; dispatch_queue_t _queue; diff --git a/Spec/ObjectLifetimes.swift b/Spec/ObjectLifetimes.swift index 8055da147..be86967ba 100644 --- a/Spec/ObjectLifetimes.swift +++ b/Spec/ObjectLifetimes.swift @@ -21,12 +21,14 @@ class ObjectLifetimes: QuickSpec { var realtime: ARTRealtime? = ARTRealtime(options: options) weak var internalRealtime: ARTRealtimeInternal? = realtime!.internal weak var internalConn: ARTConnectionInternal? = realtime!.connection.internal + weak var internalRest: ARTRestInternal? = realtime!.internal.rest waitUntil(timeout: testTimeout) { done in options.internalDispatchQueue.async { realtime = nil // Schedule deallocation for later in this queue expect(internalConn).toNot(beNil()) // Deallocation still hasn't happened. expect(internalRealtime).toNot(beNil()) + expect(internalRest).toNot(beNil()) done() } } @@ -37,6 +39,7 @@ class ObjectLifetimes: QuickSpec { options.internalDispatchQueue.async { expect(internalConn).to(beNil()) expect(internalRealtime).to(beNil()) + expect(internalRest).to(beNil()) done() } }