GObject.CClosure.new_object_swap
Description: Reference for GObject.CClosure.new_object_swap

### Function

# GObject CClosurenew_object_swap

#### Declaration [src]

    GClosure*
    g_cclosure_new_object_swap (
      GCallback callback_func,
      GObject* object
    )

#### Description [src]

A variant of `g_cclosure_new_swap()` which uses `object` as `user_data` and calls `g_object_watch_closure()` on `object` and the created closure. This function is useful when you have a callback closely associated with a `GObject`, and want the callback to no longer run after the object is is freed.

This function is not directly available to language bindings.

#### Parameters

`callback_func`

  Type: `GCallback`

  The function to invoke.

`object`

  Type: `GObject`

  A `GObject` pointer to pass to `callback_func`.

  The data is owned by the caller of the function.

#### Return value

Type: `GClosure`

A new `GCClosure`.

The data is owned by the called function.