Skip to content

Commit 9eca634

Browse files
committed
Fixes to OnClose in wxpython.py. It is not required to call CloseBrowser
nor StopLoad.
1 parent 11e32d8 commit 9eca634

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

cefpython/cef3/windows/binaries/wxpython.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,17 @@ def OnSize(self, event):
211211
cefpython.WindowUtils.OnSize(self.GetHandleForBrowser(), 0, 0, 0)
212212

213213
def OnClose(self, event):
214-
if self.browser:
215-
# Calling CloseBrowser will cause that OnClose event occurs again,
216-
# so self.browser must be checked if non-empty.
217-
self.browser.StopLoad()
218-
self.browser.CloseBrowser()
219-
# Remove all CEF browser references so that browser is closed
220-
# cleanly. Otherwise there may be issues for example with cookies
221-
# not being flushed to disk when closing app immediately
222-
# (Issue 158).
223-
del self.javascriptExternal.mainBrowser
224-
del self.clientHandler.mainBrowser
225-
del self.browser
226-
self.Destroy()
214+
# Remove all CEF browser references so that browser is closed
215+
# cleanly. Otherwise there may be issues for example with cookies
216+
# not being flushed to disk when closing app immediately
217+
# (Issue 158).
218+
del self.javascriptExternal.mainBrowser
219+
del self.clientHandler.mainBrowser
220+
del self.browser
221+
222+
# Destroy wx frame, this will complete the destruction of CEF browser
223+
self.Destroy()
224+
227225
# In wx.chromectrl calling browser.CloseBrowser and/or self.Destroy
228226
# may cause crashes when embedding multiple browsers in tab
229227
# (Issue 107). In such case instead of calling CloseBrowser/Destroy

0 commit comments

Comments
 (0)