Took care of disposal of burn_disc ovbject

This commit is contained in:
Thomas Schmitt 2007-10-18 22:17:46 +00:00
parent a30704318f
commit 2c270d6153
3 changed files with 29 additions and 17 deletions

View File

@ -217,21 +217,31 @@ int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
int flag); int flag);
/** Prepare a disc for writing the new session. /** Create a disc object for writing the new session from the created or loaded
@param drive The target drive iso_volset which has been manipulated via libisofs, to the same media from
@param disc A burn_disc suitable to pass to isoburn_disc_write(). where the image was eventually loaded. This struct burn_disc is ready for
use by a subsequent call to isoburn_disc_write().
After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE
again, the burn_disc object has to be disposed by burn_disc_free().
@param drive The combined source and target drive, grabbed with
isoburn_drive_scan_and_grab(). .
@param disc Returns the newly created burn_disc object.
@return <=0 error , 1 = success @return <=0 error , 1 = success
*/ */
int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc, int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc,
struct isoburn_source_opts *opts); struct isoburn_source_opts *opts);
/** Prepare a disc for creating a new image from the contents of a previous /** Create a disc object for producing a new image from a previous image
image volset plus the changes made by user. The generated burn_disc is plus the changes made by user. The generated burn_disc is suitable
suitable to be written to any libburn drive. You shouldn't use the same to be written to any other libburn drive. You must not use the same drive
drive you're using as source. for writing as you are using here as source, because data will be
read from the source drive while the target drive gets written to.
The resulting burn_disc object has to be disposed when all its writing
is done and the drive is BURN_DRIVE_IDLE again after asynchronous
burn_disc_write().
@param d The source drive, grabbed with isoburn_drive_scan_and_grab(). @param d The source drive, grabbed with isoburn_drive_scan_and_grab().
@param disc A burn_disc suitable to pass to burn_disc_write. @param disc Returns the newly created burn_disc object.
@return <=0 error , 1 = success @return <=0 error , 1 = success
*/ */
int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc, int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.18.185731" #define Xorriso_timestamP "2007.10.18.221756"

View File

@ -259,7 +259,7 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
struct isoburn_source_opts sopts; struct isoburn_source_opts sopts;
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
struct burn_drive *drive; struct burn_drive *drive;
struct burn_disc *disc; struct burn_disc *disc= NULL;
struct burn_write_opts *burn_options; struct burn_write_opts *burn_options;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
@ -293,19 +293,19 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Cannot prepare disc"); sprintf(xorriso->info_text,"Cannot prepare disc");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0); {ret= 0; goto ex;}
} }
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0); ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
if(ret<=0) if(ret<=0)
return(ret); goto ex;
isoburn_disc_write(burn_options, disc); isoburn_disc_write(burn_options, disc);
burn_write_opts_free(burn_options); burn_write_opts_free(burn_options);
ret= Xorriso_pacifier_loop(xorriso, drive, 0); ret= Xorriso_pacifier_loop(xorriso, drive, 0);
if(ret<=0) if(ret<=0)
return(ret); goto ex;
ret= isoburn_activate_session(drive); ret= isoburn_activate_session(drive);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
@ -313,13 +313,15 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Could not write new set of volume descriptors"); "Could not write new set of volume descriptors");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
return(ret); goto ex;
} }
/* >>> cleanup disc ? */ ret= 1;
ex:;
if(disc!=NULL)
burn_disc_free(disc);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
return(1); return(ret);
} }