File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ g_debugFile = "debug.log"
118118g_applicationSettings = {}
119119g_commandLineSwitches = {}
120120
121+ _MessageLoopWork_wasused = False
122+
121123cdef dict g_globalClientCallbacks = {}
122124
123125# If ApplicationSettings.unique_request_context_per_browser is False
@@ -428,6 +430,10 @@ def MessageLoopWork():
428430 # GIL must be released here otherwise we will get dead lock
429431 # when calling from c++ to python.
430432
433+ if not _MessageLoopWork_wasused:
434+ global _MessageLoopWork_wasused
435+ _MessageLoopWork_wasused = True
436+
431437 with nogil:
432438 CefDoMessageLoopWork();
433439
@@ -448,13 +454,18 @@ def Shutdown():
448454 g_sharedRequestContext.Assign(NULL )
449455 Debug(" Shutdown()" )
450456 with nogil:
451- CefShutdown()
452457 # Temporary fix for possible errors on shutdown. See this post:
453458 # https://magpcss.org/ceforum/viewtopic.php?p=30858#p30858
454459 # May be fixed by host owned message loop, see Issue 1805:
455460 # https://bitbucket.org/chromiumembedded/cef/issues/1805/
456- for i in range (10 ):
457- CefDoMessageLoopWork()
461+ if _MessageLoopWork_wasused:
462+ for i in range (10 ):
463+ CefDoMessageLoopWork()
464+ CefShutdown()
465+ if _MessageLoopWork_wasused:
466+ for i in range (10 ):
467+ CefDoMessageLoopWork()
468+
458469
459470
460471def SetOsModalLoop (py_bool modalLoop ):
You can’t perform that action at this time.
0 commit comments