Hi, @sammcewan
Thanks a lot for supporting this component, it's really helpful and convenient in use.
But I found a possible memory issue that might appear in some cases.
For example, if popover controller should be presented from a view, retain cycle may occur:
MyView creates popover, holds strong reference to WYPopoverController, and calls
-(void)presentPopoverInRect:rect inView:self ... method.
At this moment, WYPopoverController assigns strong reference of MYView to inView ivar. But this leads to retain cycle and MYView and WYPopoverController instances will never deallocated.
Adding __weak attribute to inView ivar can lead to crashes when popover is still presented but inView is already deallocated,
So it seems that solution to breaking retain cycle is to assign inView = nil in
-(void)dismissPopover method.
Hi, @sammcewan Thanks a lot for supporting this component, it's really helpful and convenient in use.
But I found a possible memory issue that might appear in some cases.
For example, if popover controller should be presented from a view, retain cycle may occur:
MyView
creates popover, holds strong reference toWYPopoverController
, and calls-(void)presentPopoverInRect:rect inView:self ...
method.At this moment, WYPopoverController assigns strong reference of
MYView
toinView
ivar. But this leads to retain cycle andMYView
andWYPopoverController
instances will never deallocated.Adding
__weak
attribute toinView
ivar can lead to crashes when popover is still presented butinView
is already deallocated, So it seems that solution to breaking retain cycle is to assigninView = nil
in-(void)dismissPopover
method.Thanks!