mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Linux: cefclient: Fix GTK behavior with multi-threaded-message-loop (fixes issue #3087)
Switch to using g_main_context_default() in MainMessageLoopMultithreadedGtk. As of M86 (https://crrev.com/b960daf4e6) Chromium now creates its own context in MessagePumpGlib so we can use the default context in cefclient. This is also more "correct" from a GTK usage perspective. As part of this change all GTK dialogs and callbacks are now executed on the main thread instead of the UI thread (note that these are the same thread when not using multi-threaded-message-loop).
This commit is contained in:
@ -78,10 +78,9 @@ MainMessageLoopMultithreadedGtk::~MainMessageLoopMultithreadedGtk() {
|
||||
int MainMessageLoopMultithreadedGtk::Run() {
|
||||
DCHECK(RunsTasksOnCurrentThread());
|
||||
|
||||
// Chromium uses the default GLib context so we create our own context and
|
||||
// make it the default for this thread.
|
||||
main_context_ = g_main_context_new();
|
||||
g_main_context_push_thread_default(main_context_);
|
||||
// We use the default Glib context and Chromium creates its own context in
|
||||
// MessagePumpGlib (starting in M86).
|
||||
main_context_ = g_main_context_default();
|
||||
|
||||
main_loop_ = g_main_loop_new(main_context_, TRUE);
|
||||
|
||||
@ -100,8 +99,6 @@ int MainMessageLoopMultithreadedGtk::Run() {
|
||||
g_main_loop_unref(main_loop_);
|
||||
main_loop_ = nullptr;
|
||||
|
||||
g_main_context_pop_thread_default(main_context_);
|
||||
g_main_context_unref(main_context_);
|
||||
main_context_ = nullptr;
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user