Skip to content

Commit

Permalink
Fix crash on exit when closing browser immediately (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed Aug 17, 2018
1 parent a010e68 commit 66107b2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/browser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,17 @@ cdef class PyBrowser:
# will be called.
Debug("CefBrowser::CloseBrowser(%s)" % forceClose)

# Fix Issue #454 "Crash on exit when closing browser
# immediately during initial loading".
if not self.cefBrowser.get():
Debug("cefBrowser.get() failed in CloseBrowser")
return
# From testing it seems that only cefBrowser.get() can fail,
# however let's check the host as well just to be safe.
if not self.cefBrowser.get().GetHost().get():
Debug("cefBrowser.get().GetHost() failed in CloseBrowser")
return

# Flush cookies to disk. Temporary solution for Issue #365.
# A similar call is made in LifespanHandler_OnBeforeClose.
# If using GetCookieManager to implement custom cookie managers
Expand Down

0 comments on commit 66107b2

Please sign in to comment.