Commit f440f850 authored by Marshall Greenblatt's avatar Marshall Greenblatt

cefclient: macOS: Fix CefBrowser leak during OSR shutdown (issue #2151)

parent f2b988a0
......@@ -189,12 +189,19 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
name:NSWindowDidChangeBackingPropertiesNotification
object:nil];
if (text_input_context_osr_mac_) {
[GetInputClientFromContext(text_input_context_osr_mac_) release];
[text_input_context_osr_mac_ release];
}
[super dealloc];
}
- (void)detach {
renderer_ = NULL;
browser_window_ = NULL;
if (text_input_context_osr_mac_)
[GetInputClientFromContext(text_input_context_osr_mac_) detach];
}
- (CefRefPtr<CefBrowser>)getBrowser {
......@@ -527,10 +534,11 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
- (NSTextInputContext*)inputContext {
if (!text_input_context_osr_mac_) {
CefTextInputClientOSRMac* text_input_client =
[[CefTextInputClientOSRMac alloc] initWithBrowser:[self getBrowser]];
[[[CefTextInputClientOSRMac alloc]
initWithBrowser:[self getBrowser]] retain];
text_input_context_osr_mac_ = [[NSTextInputContext alloc] initWithClient:
text_input_client];
text_input_context_osr_mac_ = [[[NSTextInputContext alloc] initWithClient:
text_input_client] retain];
}
return text_input_context_osr_mac_;
......
......@@ -66,6 +66,7 @@
@property(nonatomic) BOOL handlingKeyDown;
- (id)initWithBrowser:(CefRefPtr<CefBrowser>)browser;
- (void)detach;
- (void)HandleKeyEventBeforeTextInputClient:(NSEvent*)keyEvent;
- (void)HandleKeyEventAfterTextInputClient:(CefKeyEvent)keyEvent;
- (void)ChangeCompositionRange:(CefRange)range
......
......@@ -69,6 +69,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
return self;
}
- (void)detach {
browser_ = NULL;
}
- (NSArray*)validAttributesForMarkedText {
if (!validAttributesForMarkedText_) {
validAttributesForMarkedText_ = [[NSArray alloc] initWithObjects:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment