Commit c3d759c3 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt Committed by Daniel Boles

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
parent a7ca5335
......@@ -781,7 +781,7 @@ gtk_print_job_get_page_ranges (GtkPrintJob *job,
/**
* gtk_print_job_set_page_ranges:
* @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
* @n_ranges: the length of the @ranges array
*
......@@ -794,6 +794,7 @@ gtk_print_job_set_page_ranges (GtkPrintJob *job,
GtkPageRange *ranges,
gint n_ranges)
{
g_free (job->priv->page_ranges);
job->priv->page_ranges = ranges;
job->priv->num_page_ranges = n_ranges;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment