### Function

# GObject clear_object

since: 2.28

#### Declaration [src]

    void
    g_clear_object (
      GObject** object_ptr
    )

#### Description [src]

Clears a reference to a `GObject`.

`object_ptr` must not be `NULL`.

If the reference is `NULL` then this function does nothing. Otherwise, the reference count of the object is decreased and the pointer is set to `NULL`.

A macro is also included that allows this function to be used without pointer casts.

Available since: 2.28

This function is not directly available to language bindings.

#### Parameters

`object_ptr`

  Type: `GObject`

  A pointer to a `GObject` reference.

  The data is owned by the caller of the function.