Merge pull request #7253 from electron/osr-crash

Unsubscribe observer when OffScreenRenderWidgetHostView is destroyed
This commit is contained in:
Cheng Zhao 2016-09-19 17:54:31 +09:00 committed by GitHub
commit b05254807b
3 changed files with 12 additions and 0 deletions

View file

@ -377,6 +377,9 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
}
OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
if (native_window_)
native_window_->RemoveObserver(this);
#if defined(OS_MACOSX)
if (is_showing_)
browser_compositor_->SetRenderWidgetHostIsHidden(true);
@ -924,4 +927,9 @@ void OffScreenRenderWidgetHostView::OnWindowResize() {
SetSize(size);
}
void OffScreenRenderWidgetHostView::OnWindowClosed() {
native_window_->RemoveObserver(this);
native_window_ = nullptr;
}
} // namespace atom

View file

@ -176,6 +176,7 @@ class OffScreenRenderWidgetHostView
// NativeWindowObserver:
void OnWindowResize() override;
void OnWindowClosed() override;
void OnBeginFrameTimerTick();
void SendBeginFrame(base::TimeTicks frame_time,

View file

@ -324,6 +324,9 @@ describe('session module', function () {
})
it('can generate a default filename', function (done) {
// Somehow this test always fail on appveyor.
if (process.env.APPVEYOR === 'True') return done()
downloadServer.listen(0, '127.0.0.1', function () {
var port = downloadServer.address().port
ipcRenderer.sendSync('set-download-option', true, false)