GObject.Object.watch_closure

### Method

# GObject Objectwatch_closure

#### Declaration [src]

    void
    g_object_watch_closure (
      GObject* object,
      GClosure* closure
    )

#### Description [src]

This function essentially limits the life time of the `closure` to the life time of the object. That is, when the object is finalized, the `closure` is invalidated by calling `g_closure_invalidate()` on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, `g_object_ref()` and `g_object_unref()` are added as marshal guards to the `closure`, to ensure that an extra reference count is held on `object` during invocation of the `closure`. Usually, this function will be called on closures that use this `object` as closure data.

#### Parameters

`closure`

  Type: `GClosure`

  `GClosure` to watch.

  The data is owned by the caller of the method.