IOS-1143 no more PEPObjHolder (Backed out changeset 08e538c4c945)
authorDirk Zimmermann <dirk@pep-project.org>
Wed, 04 Jul 2018 13:21:53 +0200
changeset 638f67f4bd9e683
parent 637 2910f5cf61ea
child 639 c04d1870188f
IOS-1143 no more PEPObjHolder (Backed out changeset 08e538c4c945)
pEpObjCAdapter.xcodeproj/project.pbxproj
pEpObjCAdapter/PEPObjHolder.h
pEpObjCAdapter/PEPObjHolder.m
pEpObjCAdapter/PEPSessionProvider.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Wed Jul 04 13:21:53 2018 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Wed Jul 04 13:21:53 2018 +0200
     1.3 @@ -35,7 +35,6 @@
     1.4  		435665CC2080A6CB00EC5B10 /* NSNumber+PEPRating.m in Sources */ = {isa = PBXBuildFile; fileRef = 435665CB2080A6CB00EC5B10 /* NSNumber+PEPRating.m */; };
     1.5  		435796E31FB5E51A00395A9E /* PEPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 435796E21FB5E51A00395A9E /* PEPMessage.m */; };
     1.6  		43676B661C57EA1A00233933 /* B623F674_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43676B641C57EA1A00233933 /* B623F674_sec.asc */; };
     1.7 -		4386DA6B20ECB2AF007A16C9 /* PEPObjHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4386DA6A20ECB2AF007A16C9 /* PEPObjHolder.m */; };
     1.8  		439393E6208F375800EB1DBD /* NSObject+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 439393E5208F375800EB1DBD /* NSObject+Extension.m */; };
     1.9  		439393F8208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m in Sources */ = {isa = PBXBuildFile; fileRef = 439393F7208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m */; };
    1.10  		43953B3520C91E2B001C7DDB /* NSDictionary+Debug.m in Sources */ = {isa = PBXBuildFile; fileRef = 43953B3420C91E2B001C7DDB /* NSDictionary+Debug.m */; };
    1.11 @@ -171,8 +170,6 @@
    1.12  		435796E21FB5E51A00395A9E /* PEPMessage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPMessage.m; sourceTree = "<group>"; };
    1.13  		43676B631C57EA1A00233933 /* 0xB623F674.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 0xB623F674.asc; sourceTree = "<group>"; };
    1.14  		43676B641C57EA1A00233933 /* B623F674_sec.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = B623F674_sec.asc; sourceTree = "<group>"; };
    1.15 -		4386DA6920ECB2AF007A16C9 /* PEPObjHolder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPObjHolder.h; sourceTree = "<group>"; };
    1.16 -		4386DA6A20ECB2AF007A16C9 /* PEPObjHolder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPObjHolder.m; sourceTree = "<group>"; };
    1.17  		439393E4208F375800EB1DBD /* NSObject+Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+Extension.h"; sourceTree = "<group>"; };
    1.18  		439393E5208F375800EB1DBD /* NSObject+Extension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Extension.m"; sourceTree = "<group>"; };
    1.19  		439393F6208F5B5E00EB1DBD /* NSMutableDictionary+PEP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+PEP.h"; sourceTree = "<group>"; };
    1.20 @@ -333,8 +330,6 @@
    1.21  				439393E5208F375800EB1DBD /* NSObject+Extension.m */,
    1.22  				439393F6208F5B5E00EB1DBD /* NSMutableDictionary+PEP.h */,
    1.23  				439393F7208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m */,
    1.24 -				4386DA6920ECB2AF007A16C9 /* PEPObjHolder.h */,
    1.25 -				4386DA6A20ECB2AF007A16C9 /* PEPObjHolder.m */,
    1.26  			);
    1.27  			path = pEpObjCAdapter;
    1.28  			sourceTree = "<group>";
    1.29 @@ -517,7 +512,6 @@
    1.30  				43209B421ECC2DBC007E7E2E /* PEPQueue.m in Sources */,
    1.31  				435665CC2080A6CB00EC5B10 /* NSNumber+PEPRating.m in Sources */,
    1.32  				439393F8208F5B5E00EB1DBD /* NSMutableDictionary+PEP.m in Sources */,
    1.33 -				4386DA6B20ECB2AF007A16C9 /* PEPObjHolder.m in Sources */,
    1.34  				15206CC71F8E078B003FF880 /* PEPSession.m in Sources */,
    1.35  			);
    1.36  			runOnlyForDeploymentPostprocessing = 0;
     2.1 --- a/pEpObjCAdapter/PEPObjHolder.h	Wed Jul 04 13:21:53 2018 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,17 +0,0 @@
     2.4 -//
     2.5 -//  PEPObjHolder.h
     2.6 -//  pEpObjCAdapter
     2.7 -//
     2.8 -//  Created by Dirk Zimmermann on 04.07.18.
     2.9 -//  Copyright © 2018 p≡p. All rights reserved.
    2.10 -//
    2.11 -
    2.12 -#import <Foundation/Foundation.h>
    2.13 -
    2.14 -@interface PEPObjHolder : NSObject
    2.15 -
    2.16 -@property id object;
    2.17 -
    2.18 -- (instancetype)initWithObject:(id _Nullable)object;
    2.19 -
    2.20 -@end
     3.1 --- a/pEpObjCAdapter/PEPObjHolder.m	Wed Jul 04 13:21:53 2018 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,21 +0,0 @@
     3.4 -//
     3.5 -//  PEPObjHolder.m
     3.6 -//  pEpObjCAdapter
     3.7 -//
     3.8 -//  Created by Dirk Zimmermann on 04.07.18.
     3.9 -//  Copyright © 2018 p≡p. All rights reserved.
    3.10 -//
    3.11 -
    3.12 -#import "PEPObjHolder.h"
    3.13 -
    3.14 -@implementation PEPObjHolder
    3.15 -
    3.16 -- (instancetype)initWithObject:(id _Nullable)object
    3.17 -{
    3.18 -    if (self = [super init]) {
    3.19 -        _object = object;
    3.20 -    }
    3.21 -    return self;
    3.22 -}
    3.23 -
    3.24 -@end
     4.1 --- a/pEpObjCAdapter/PEPSessionProvider.m	Wed Jul 04 13:21:53 2018 +0200
     4.2 +++ b/pEpObjCAdapter/PEPSessionProvider.m	Wed Jul 04 13:21:53 2018 +0200
     4.3 @@ -11,7 +11,6 @@
     4.4  #import "PEPObjCAdapter+Internal.h"
     4.5  #import "PEPInternalSession.h"
     4.6  #import "PEPCopyableThread.h"
     4.7 -#import "PEPObjHolder.h"
     4.8  
     4.9  @implementation PEPSessionProvider
    4.10  
    4.11 @@ -22,7 +21,7 @@
    4.12   alive until all sessiopns created afterwards have been teared down."
    4.13   Here we hold it.
    4.14   */
    4.15 -static PEPObjHolder *s_sessionForMainThread = nil;
    4.16 +static PEPInternalSession *s_sessionForMainThread = nil;
    4.17  
    4.18  #pragma mark - Public API
    4.19  
    4.20 @@ -35,7 +34,7 @@
    4.21  
    4.22      if ([NSThread isMainThread]) {
    4.23          [[self sessionForThreadLock] unlock];
    4.24 -        return s_sessionForMainThread.object;
    4.25 +        return s_sessionForMainThread;
    4.26      }
    4.27  
    4.28      NSMutableDictionary<PEPCopyableThread*,PEPInternalSession*> *dict = [self sessionForThreadDict];
    4.29 @@ -72,7 +71,6 @@
    4.30  {
    4.31      s_sessionForThreadLock = [NSLock new];
    4.32      s_sessionForThreadDict = [NSMutableDictionary new];
    4.33 -    s_sessionForMainThread = [PEPObjHolder new];
    4.34  }
    4.35  
    4.36  #pragma mark - Lock
    4.37 @@ -110,21 +108,21 @@
    4.38  {
    4.39      // shared code to set global configuration every time
    4.40      void (^configurationBlock)(void) = ^{
    4.41 -        [self setConfigUnEncryptedSubjectOnSession:s_sessionForMainThread.object];
    4.42 -        [self setPassiveModeOnSession:s_sessionForMainThread.object];
    4.43 +        [self setConfigUnEncryptedSubjectOnSession:s_sessionForMainThread];
    4.44 +        [self setPassiveModeOnSession:s_sessionForMainThread];
    4.45      };
    4.46  
    4.47 -    if (s_sessionForMainThread.object) {
    4.48 +    if (s_sessionForMainThread) {
    4.49          configurationBlock();
    4.50          return;
    4.51      }
    4.52  
    4.53      // shared code that is executed in any case, either on the main thread or in the background
    4.54      void (^creationBlock)(void) = ^{
    4.55 -        if (s_sessionForMainThread.object) {
    4.56 +        if (s_sessionForMainThread) {
    4.57              return;
    4.58          }
    4.59 -        s_sessionForMainThread.object = [PEPInternalSession new];
    4.60 +        s_sessionForMainThread = [PEPInternalSession new];
    4.61          configurationBlock();
    4.62      };
    4.63  
    4.64 @@ -143,13 +141,9 @@
    4.65      for (PEPCopyableThread *thread in dict.allKeys) {
    4.66          [self nullifySessionForThread:thread];
    4.67      }
    4.68 -
    4.69 -    if (s_sessionForMainThread.object != nil) {
    4.70 +    s_sessionForMainThread = nil;
    4.71          NSLog(@"*** 0x%lu (niling s_sessionForMainThread)",
    4.72                (u_long) s_sessionForMainThread.object);
    4.73 -        s_sessionForMainThread.object = nil;
    4.74 -    }
    4.75 -
    4.76      [dict removeAllObjects];
    4.77  }
    4.78