WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
144732
[GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext
https://bugs.webkit.org/show_bug.cgi?id=144732
Summary
[GTK] RunLoop constructor should properly retrieve or establish the thread-de...
Zan Dobersek
Reported
2015-05-07 01:54:34 PDT
[GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext
Attachments
Patch
(2.86 KB, patch)
2015-05-07 02:06 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(2.88 KB, patch)
2015-05-07 02:56 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(3.06 KB, patch)
2015-05-14 00:52 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2015-05-07 02:06:22 PDT
Created
attachment 252581
[details]
Patch
Carlos Garcia Campos
Comment 2
2015-05-07 02:21:01 PDT
Comment on
attachment 252581
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252581&action=review
> Source/WTF/wtf/gtk/RunLoopGtk.cpp:40 > + GMainContext* runLoopContext = g_main_context_get_thread_default(); > + if (!runLoopContext) { > + if (!isMainThread()) { > + m_mainContext = adoptGRef(g_main_context_new());
This could be simplified by using g_main_context_ref_thread_default(), because it ensures a main context is returned.
> Source/WTF/wtf/gtk/RunLoopGtk.cpp:41 > + g_main_context_push_thread_default(m_mainContext.get());
I'm not sure about doing this here, I think it should be done before running the loop, and pop it after it quits. Doing it here, means that if a thread doesn't use a RunLoop, but something like RunLoop::isMain() is called, RunLoop::current() creates a new RunLoop for the thread and pushes a new main context.
Zan Dobersek
Comment 3
2015-05-07 02:56:58 PDT
Created
attachment 252582
[details]
Patch
Carlos Garcia Campos
Comment 4
2015-05-07 09:52:12 PDT
Comment on
attachment 252582
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252582&action=review
> Source/WTF/wtf/gtk/RunLoopGtk.cpp:66 > + g_main_context_push_thread_default(mainContext);
So, are we doing this also for the main thread?
Zan Dobersek
Comment 5
2015-05-07 23:54:58 PDT
Comment on
attachment 252582
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252582&action=review
>> Source/WTF/wtf/gtk/RunLoopGtk.cpp:66 >> + g_main_context_push_thread_default(mainContext); > > So, are we doing this also for the main thread?
Yes. g_main_context_push_thread_default() checks if the passed-in context is the global-default one, pushing a null pointer on the top of the stack in that case. That way g_main_context_get_thread_default() still returns a null pointer on the main thread.
Zan Dobersek
Comment 6
2015-05-14 00:52:38 PDT
Created
attachment 253110
[details]
Patch
Zan Dobersek
Comment 7
2015-05-14 02:34:16 PDT
Comment on
attachment 253110
[details]
Patch Clearing flags on attachment: 253110 Committed
r184333
: <
http://trac.webkit.org/changeset/184333
>
Zan Dobersek
Comment 8
2015-05-14 02:34:23 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug