Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Feb 1, 2021
1 parent 0cf3551 commit 92d0621
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Blink/SmarterKeys/SmarterTermInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CaretHider {

var isHardwareKB: Bool { kbView.traits.isHKBAttached }

var device: TermDevice? = nil {
weak var device: TermDevice? = nil {
didSet { reportStateReset() }
}

Expand Down
1 change: 1 addition & 0 deletions Blink/TermView.m
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ - (void)terminate
{
_device = nil;
// Disconnect message handler
[_webView terminate];
[_webView.configuration.userContentController removeScriptMessageHandlerForName:@"interOp"];
}

Expand Down
1 change: 1 addition & 0 deletions KB/Native/Views/KBWebViewBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)onOut:(NSString *)data;
- (void)onIME:(NSString *)event data:(NSString *)data;
- (void)setTrackingModifierFlags:(UIKeyModifierFlags)trackingModifierFlags;
- (void)terminate;

- (void)_keyboardDidChangeFrame:(NSNotification *)notification;
- (void)_keyboardWillChangeFrame:(NSNotification *)notification;
Expand Down
3 changes: 3 additions & 0 deletions KB/Native/Views/KBWebViewBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguratio



- (void)terminate {
[self.configuration.userContentController removeScriptMessageHandlerForName:_interopName];
}

- (void)dealloc {
[NSNotificationCenter.defaultCenter removeObserver:self];
Expand Down

0 comments on commit 92d0621

Please sign in to comment.