mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 15:33:39 +02:00
Add g_main_context_ref_thread_default()
Add g_main_context_ref_thread_default(), which always returns a reffed GMainContext, rather than sometimes returning a (non-reffed) GMainContext, and sometimes returning NULL. This simplifies the bookkeeping in any code that needs to keep a reference to the thread-default context for a while. https://bugzilla.gnome.org/show_bug.cgi?id=660994
This commit is contained in:
@@ -547,12 +547,7 @@ g_settings_init (GSettings *settings)
|
||||
G_TYPE_SETTINGS,
|
||||
GSettingsPrivate);
|
||||
|
||||
settings->priv->main_context = g_main_context_get_thread_default ();
|
||||
|
||||
if (settings->priv->main_context == NULL)
|
||||
settings->priv->main_context = g_main_context_default ();
|
||||
|
||||
g_main_context_ref (settings->priv->main_context);
|
||||
settings->priv->main_context = g_main_context_ref_thread_default ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user