diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2013-11-26 15:04:45 +0000 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-03-09 13:41:37 +0000 |
commit | af36220bca74837cefab046a6435f2b6743c4569 (patch) | |
tree | c9a3f625d6370ebd9b53699787e8a59951ced3e1 /gtk/gtkprintcontext.c | |
parent | 8e3b49969905182c903dc62f0f6e6debefefe973 (diff) | |
download | gtk+-af36220bca74837cefab046a6435f2b6743c4569.tar.gz |
gtkprintcontext: Fix several potential g_object_[un]ref(NULL) calls
The page_setup of a GtkPrintContext or GtkPrintUnixDialog is nullable,
so all reference count changes to it have to be guarded against NULL
values.
Found by scan-build.
https://bugzilla.gnome.org/show_bug.cgi?id=712760
Diffstat (limited to 'gtk/gtkprintcontext.c')
-rw-r--r-- | gtk/gtkprintcontext.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c index f65de539cc..d3c5a02635 100644 --- a/gtk/gtkprintcontext.c +++ b/gtk/gtkprintcontext.c @@ -355,8 +355,9 @@ _gtk_print_context_set_page_setup (GtkPrintContext *context, g_return_if_fail (GTK_IS_PRINT_CONTEXT (context)); g_return_if_fail (page_setup == NULL || GTK_IS_PAGE_SETUP (page_setup)); - - g_object_ref (page_setup); + + if (page_setup != NULL) + g_object_ref (page_setup); if (context->page_setup != NULL) g_object_unref (context->page_setup); |