GLib.MainContext.find_source_by_id

### Method

# GLib MainContextfind_source_by_id

#### Declaration

    GSource*
    g_main_context_find_source_by_id (
      GMainContext* context,
      guint source_id
    )

#### Description

Finds a `GSource` given a pair of context and ID.

It is a programmer error to attempt to look up a non-existent source.

More specifically: source IDs can be reissued after a source has been destroyed and therefore it is never valid to use this function with a source ID which may have already been removed. An example is when scheduling an idle to run in another thread with g_idle_add(): the idle may already have run and been removed by the time this function is called on its (now invalid) source ID. This source ID may have been reissued, leading to the operation being performed against the wrong source.

#### Parameters

`source_id`

  Type: `guint`

  The source ID, as returned by g_source_get_id().

#### Return value

Type: `GSource`

The `GSource`.

The data is owned by the instance.