Skip to content

Commit

Permalink
fixed problem with cocoapods arc projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvise Susmel committed Apr 4, 2013
1 parent 309445b commit f0fc850
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion FPPopoverController.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

//ARC-enable and disable support
#if __has_feature(objc_arc)
@property(nonatomic,weak) id<FPPopoverControllerDelegate> delegate;
@property(nonatomic,assign) id<FPPopoverControllerDelegate> delegate;
#else
@property(nonatomic,assign) id<FPPopoverControllerDelegate> delegate;
#endif
Expand Down
9 changes: 5 additions & 4 deletions FPPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ -(void)dealloc
{
[self removeObservers];
if(_shadowColor) CGColorRelease(_shadowColor);
#define FP_DEBUG

#ifdef FP_DEBUG
NSLog(@"FPPopoverController dealloc");
Expand Down Expand Up @@ -125,11 +124,12 @@ -(id)initWithViewController:(UIViewController*)viewController

#if __has_feature(objc_arc)
//ARC on
__weak typeof (self)bself = self;
id bself = self;

This comment has been minimized.

Copy link
@ninuk

ninuk Jul 9, 2013

128 - __weak typeof (self)bself = self;
127 + id bself = self;

This change appears to be causing FPPopoverController to not get released due to the extra retain from the assignment of self. Under ARC, I am using, which appears to resolve this issue:

    __weak id bself = self;

Not sure about no arc scenario.

#else
//ARC off
__block typeof (self) bself = self;
__block id bself = self;
#endif

[_touchView setTouchedOutsideBlock:^{
[bself dismissPopoverAnimated:YES];
}];
Expand Down Expand Up @@ -307,7 +307,8 @@ -(CGPoint)originFromView:(UIView*)fromView

-(void)presentPopoverFromView:(UIView*)fromView
{
_fromView = fromView;
SAFE_ARC_RELEASE(_fromView);
_fromView = SAFE_ARC_RETAIN(fromView);
[self presentPopoverFromPoint:[self originFromView:_fromView]];
}

Expand Down
11 changes: 2 additions & 9 deletions FPTouchView.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,14 @@ -(void)dealloc

-(void)setTouchedOutsideBlock:(FPTouchedOutsideBlock)outsideBlock
{
#if __has_feature(objc_arc)
_outsideBlock = outsideBlock;
#else
SAFE_ARC_RELEASE(_outsideBlock);
_outsideBlock = [outsideBlock copy];
#endif
}

-(void)setTouchedInsideBlock:(FPTouchedInsideBlock)insideBlock
{
#if __has_feature(objc_arc)
_insideBlock = insideBlock;
#else
SAFE_ARC_RELEASE(_insideBlock);
_insideBlock = [insideBlock copy];
#endif

}

-(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event
Expand Down

5 comments on commit f0fc850

@iamraafay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! I did exact same changes on my branch before I found this. Can this be tagged, please!

@gbarnett-cs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here; could we get a tag? Thanks!

@alvises
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sure. I'm doing few other fixes and I will do a tag!

@alvises
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagged as 1.4.5

@iamraafay
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks a bunch!

Please sign in to comment.