Skip to content

Commit

Permalink
fix Camera bug #37
Browse files Browse the repository at this point in the history
  • Loading branch information
李杰 committed Dec 4, 2018
1 parent 9ab76e2 commit cc2e6ab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions JJException/Source/MRC/NSObject+KVOCrash.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ - (NSMutableSet*)kvoObjectSet{

@interface JJObserverContainer : NSObject

@property (nonatomic,readwrite,strong) NSHashTable* observers;
@property (nonatomic,readwrite,retain) NSHashTable* observers;

/**
Associated owner object
*/
@property(nonatomic,readwrite,unsafe_unretained)NSObject* whichObject;
@property(nonatomic,readwrite,assign) NSObject* whichObject;

- (void)addObserver:(KVOObjectItem *)observer;

Expand Down Expand Up @@ -314,11 +314,13 @@ - (void)hookRemoveObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath{
- (void)jj_cleanKVO{

KVOObjectContainer* objectContainer = objc_getAssociatedObject(self, &DeallocKVOKey);
[objectContainer cleanKVOData];

JJObserverContainer* observerContainer = objc_getAssociatedObject(self, &ObserverDeallocKVOKey);
[observerContainer cleanObservers];

if (objectContainer) {
[objectContainer cleanKVOData];
}else if(observerContainer){
[observerContainer cleanObservers];
}
}

@end

0 comments on commit cc2e6ab

Please sign in to comment.