Unsubscribe from NSNotificationCenter when WebContents is destroyed
Due to ref-counted references the NSView is not destroyed immediately when WebContents is destroyed, so it is not reliable to do this in the destructor.
This commit is contained in:
parent
fa588f104c
commit
fc33eb99f7
3 changed files with 3 additions and 2 deletions
|
@ -19,6 +19,7 @@ InspectableWebContentsViewMac::InspectableWebContentsViewMac(InspectableWebConte
|
||||||
}
|
}
|
||||||
|
|
||||||
InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {
|
InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {
|
||||||
|
[view_ removeObservers];
|
||||||
CloseDevTools();
|
CloseDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ using brightray::InspectableWebContentsViewMac;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view;
|
- (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view;
|
||||||
|
- (void)removeObservers;
|
||||||
- (void)notifyDevToolsFocused;
|
- (void)notifyDevToolsFocused;
|
||||||
- (void)setDevToolsVisible:(BOOL)visible;
|
- (void)setDevToolsVisible:(BOOL)visible;
|
||||||
- (BOOL)isDevToolsVisible;
|
- (BOOL)isDevToolsVisible;
|
||||||
|
|
|
@ -45,9 +45,8 @@ using namespace brightray;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)removeObservers {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
|
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue