diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-12-04 17:54:48 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-12-04 17:54:48 +0000 |
commit | 0f1bcb0fd6b2c4d7488e7031d3c7fcd8fef0a79a (patch) | |
tree | 99e2f30b5bdb3311f8d7761c98c4068c9ec619c0 /gtk/gtkpagesetup.c | |
parent | c7945c9502c2572bf3364a07c43050dd135f529c (diff) | |
download | gtk+-0f1bcb0fd6b2c4d7488e7031d3c7fcd8fef0a79a.tar.gz |
Don't leak the old page size when
2006-12-04 Christian Persch <chpe@cvs.gnome.org>
* gtk/gtkpagesetup.c: (gtk_page_setup_get_paper_size),
(gtk_page_setup_set_paper_size): Don't leak the old page size when
Diffstat (limited to 'gtk/gtkpagesetup.c')
-rw-r--r-- | gtk/gtkpagesetup.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/gtkpagesetup.c b/gtk/gtkpagesetup.c index bf9793a7c1..9db0fc719d 100644 --- a/gtk/gtkpagesetup.c +++ b/gtk/gtkpagesetup.c @@ -163,6 +163,8 @@ gtk_page_setup_set_orientation (GtkPageSetup *setup, GtkPaperSize * gtk_page_setup_get_paper_size (GtkPageSetup *setup) { + g_return_val_if_fail (GTK_IS_PAGE_SETUP (setup), NULL); + return setup->paper_size; } @@ -181,7 +183,17 @@ void gtk_page_setup_set_paper_size (GtkPageSetup *setup, GtkPaperSize *size) { + GtkPaperSize *old_size; + + g_return_if_fail (GTK_IS_PAGE_SETUP (setup)); + g_return_if_fail (size != NULL); + + old_size = setup->paper_size; + setup->paper_size = gtk_paper_size_copy (size); + + if (old_size) + gtk_paper_size_free (old_size); } /** |