GLib.Source.get_context

### Method

# GLib Sourceget_context

#### Declaration [src]

    GMainContext*
    g_source_get_context (
      GSource* source
    )

#### Description [src]

Gets the `GMainContext` with which the source is associated.

You can call this on a source that has been destroyed, provided that the `GMainContext` it was attached to still exists (in which case it will return that `GMainContext`). In particular, you can always call this function on the source returned from `g_main_current_source()`. But calling this function on a source whose `GMainContext` has been destroyed is an error.

If the associated `GMainContext` could be destroy concurrently from a different thread, then this function is not safe to call and `g_source_dup_context()` should be used instead.

#### Return value

Type: `GMainContext`

The main context with which the source is associated, or `NULL` if the context has not yet been added to a source.

The returned data is owned by the instance.
The return value can be `NULL`.