Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_camera_unref ( Camera camera  ) 

Decrements the reference count of a Camera.

camera a Camera
a gphoto2 error code
If the reference count reaches 0, the camera will be freed automatically.

Definition at line 549 of file gphoto2-camera.c.

References CHECK_NULL, gp_camera_free(), GP_ERROR, gp_log(), GP_LOG_ERROR, and GP_OK.

      CHECK_NULL (camera);

      if (!camera->pc->ref_count) {
            gp_log (GP_LOG_ERROR, "gphoto2-camera", "gp_camera_unref on "
                  "a camera with ref_count == 0 should not happen "
                  "at all");
            return (GP_ERROR);

      camera->pc->ref_count -= 1;

      if (!camera->pc->ref_count) {

            /* We cannot free a camera that is currently in use */
            if (!camera->pc->used)
                  gp_camera_free (camera);

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index