-
由 jp9000 提交于
The workarounds were made because of conflicts with running multiple UI threads at once on macOS, which macOS can't do very well, and would be susceptible to crashes. This would cause crashes not only on startup but seemingly at random when using the browser source on macOS. The original "fix" was a hack to try to minimize UI code and browser UI code from executing at the same time. The macOS initial scene loading was deferred until all Qt-related and main window initialization was completed. Although this worked to some extent to prevent conflicts, it made it so that there was an initial period on startup where the entire UI seemed "blank" for users, and it was still possible for the main UI thread and the browser UI thread to clash, causing crashes seemingly at random for users. The external message pump method of CEF is the solution to the problem, which is the method which allows the main UI thread to share events with CEF. To do this, all CEF operations need to be performed in the UI thread (Qt's main thread), and CefDoMessageLoopWork() needs to be called when CefApp::OnScheduleMessagePumpWork callback is triggered. A number of other issues had to be solved as well, such as CefBrowser references getting "stuck" in the Qt event queue. With this, macOS no longer needs to do the "deferred load" hack, and browsers are now much more stable and no longer as susceptible to seemingly random crashes, improving overall program stability when browsers are used.
f21a48ff