GObject.WeakRef.init

### Method

# GObject WeakRefinit

since: 2.32

#### Declaration [src]

    void
    g_weak_ref_init (
      GWeakRef* weak_ref,
      GObject* object
    )

#### Description [src]

Initialise a non-statically-allocated `GWeakRef`.

This function also calls `g_weak_ref_set()` with `object` on the freshly-initialised weak reference.

This function should always be matched with a call to g_weak_ref_clear(). It is not necessary to use this function for a `GWeakRef` in static storage because it will already be properly initialised. Just use `g_weak_ref_set()` directly.

Available since: 2.32

This method is not directly available to language bindings.

#### Parameters

`object`

  Type: `GObject`

  A `GObject` or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.