MainContext.refThreadDefault

Gets the thread-default #GMainContext for this thread, as with [glib.main_context.MainContext.getThreadDefault], but also adds a reference to it with [glib.main_context.MainContext.ref_]. In addition, unlike [glib.main_context.MainContext.getThreadDefault], if the thread-default context is the global-default context, this will return that #GMainContext (with a ref added to it) rather than returning null.

Returns

the thread-default #GMainContext. Unref

with [glib.main_context.MainContext.unref] when you are done with it.