mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 12:40:10 +00:00
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:
parent
a7ca5335e4
commit
c3d759c3b6
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user