Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit 638d826

Browse files
committed
[[ Bug 10880 ]] Make sure multiline input delegate deregisters its observer over the view on iOS.
1 parent 2788772 commit 638d826

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

engine/src/mbliphoneinput.mm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,13 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
630630
void MCNativeInputFieldControl::DeleteView(UIView *p_view)
631631
{
632632
[p_view setDelegate: nil];
633-
[p_view release];
634633

634+
// MW-2013-05-22: [[ Bug 10880 ]] Make sure we release the delegate here as
635+
// it might need to refer to the view to deregister itself.
635636
[m_delegate release];
636637
m_delegate = nil;
638+
639+
[p_view release];
637640
}
638641

639642
////////////////////////////////////////////////////////////////////////////////
@@ -882,10 +885,13 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
882885
void MCNativeMultiLineControl::DeleteView(UIView *p_view)
883886
{
884887
[p_view setDelegate: nil];
885-
[p_view release];
886888

889+
// MW-2013-05-22: [[ Bug 10880 ]] Make sure we release the delegate here as
890+
// it might need to refer to the view to deregister itself.
887891
[m_delegate release];
888892
m_delegate = nil;
893+
894+
[p_view release];
889895
}
890896

891897
////////////////////////////////////////////////////////////////////////////////
@@ -1133,6 +1139,15 @@ - (id)initWithInstance:(MCNativeInputControl *)instance view:(UIView *)view
11331139
return self;
11341140
}
11351141

1142+
// MW-2013-05-22: [[ Bug 10880 ]] Make sure we have a 'dealloc' method so observers
1143+
// can be removed that reference this object.
1144+
- (void)dealloc
1145+
{
1146+
[m_instance -> GetView() removeObserver: self forKeyPath:@"contentSize"];
1147+
[super dealloc];
1148+
}
1149+
1150+
11361151
- (void)scrollViewWillBeginDragging: (UIScrollView*)scrollView
11371152
{
11381153
MCCustomEvent *t_event;

0 commit comments

Comments
 (0)