printjob: Clarify array ownership in gtk_print_job_set_page_ranges()
Add a documentation annotation saying that set_page_ranges transfers ownership of the GtkPageRange array. Add a g_free() call to fix a memory leak when set_page_ranges is used repeatedly. https://bugzilla.gnome.org/show_bug.cgi?id=780234
This commit is contained in:
committed by
Daniel Boles
parent
a7ca5335e4
commit
c3d759c3b6
@ -781,7 +781,7 @@ gtk_print_job_get_page_ranges (GtkPrintJob *job,
|
|||||||
/**
|
/**
|
||||||
* gtk_print_job_set_page_ranges:
|
* gtk_print_job_set_page_ranges:
|
||||||
* @job: a #GtkPrintJob
|
* @job: a #GtkPrintJob
|
||||||
* @ranges: (array length=n_ranges): pointer to an array of
|
* @ranges: (array length=n_ranges) (transfer full): pointer to an array of
|
||||||
* #GtkPageRange structs
|
* #GtkPageRange structs
|
||||||
* @n_ranges: the length of the @ranges array
|
* @n_ranges: the length of the @ranges array
|
||||||
*
|
*
|
||||||
@ -794,6 +794,7 @@ gtk_print_job_set_page_ranges (GtkPrintJob *job,
|
|||||||
GtkPageRange *ranges,
|
GtkPageRange *ranges,
|
||||||
gint n_ranges)
|
gint n_ranges)
|
||||||
{
|
{
|
||||||
|
g_free (job->priv->page_ranges);
|
||||||
job->priv->page_ranges = ranges;
|
job->priv->page_ranges = ranges;
|
||||||
job->priv->num_page_ranges = n_ranges;
|
job->priv->num_page_ranges = n_ranges;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user