Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_camera_free ( Camera *  camera  ) 

gp_camera_free: : a Camera

Frees the camera. This function should never be used. Please use gp_camera_unref instead.

Return value: a gphoto2 error code

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

References gp_camera_exit(), and gp_filesystem_free().

Referenced by gp_camera_new(), and gp_camera_unref().

      CHECK_NULL (camera);

      gp_log (GP_LOG_DEBUG, "gp-camera", "Freeing camera...");

       * If the camera is currently initialized, close the connection.
       * We don't care if we are successful or not.
      if (camera->port && camera->pc && camera->pc->lh)
            gp_camera_exit (camera, NULL);

      /* We don't care if anything goes wrong */
      if (camera->port) {
            gp_port_free (camera->port);
            camera->port = NULL;

      if (camera->pc) {
            if (camera->pc->timeout_ids)
                  free (camera->pc->timeout_ids);
            free (camera->pc);
            camera->pc = NULL;

      if (camera->fs) {
            gp_filesystem_free (camera->fs);
            camera->fs = NULL;

        if (camera->functions) {
                free (camera->functions);
            camera->functions = NULL;
      free (camera);

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index