summaryrefslogtreecommitdiff
path: root/gtk/gtkprintunixdialog.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-04-01 22:02:38 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-04-01 22:05:02 -0400
commit315bb30220a6df0d61bb1959aab7cd5fa9a67217 (patch)
treeec4c15a83f76c5b2545262f1158a768601b7d4e4 /gtk/gtkprintunixdialog.c
parenteb02dacb370e8b4e6ef62328d0c09673b1234b32 (diff)
downloadgtk+-315bb30220a6df0d61bb1959aab7cd5fa9a67217.tar.gz
Fix some refcounting issues in the print dialog
gtk_tree_model_get returns a reference for objects, but the printers in the model can be NULL, https://bugzilla.gnome.org/show_bug.cgi?id=646446
Diffstat (limited to 'gtk/gtkprintunixdialog.c')
-rw-r--r--gtk/gtkprintunixdialog.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index d555c1b865..0a7e6ac17b 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -774,13 +774,11 @@ void set_cell_sensitivity_func (GtkTreeViewColumn *tree_column,
gtk_tree_model_get (tree_model, iter, PRINTER_LIST_COL_PRINTER_OBJ, &printer, -1);
if (printer != NULL && !gtk_printer_is_accepting_jobs (printer))
- g_object_set (cell,
- "sensitive", FALSE,
- NULL);
+ g_object_set (cell, "sensitive", FALSE, NULL);
else
- g_object_set (cell,
- "sensitive", TRUE,
- NULL);
+ g_object_set (cell, "sensitive", TRUE, NULL);
+
+ g_object_unref (printer);
}
static void
@@ -1009,10 +1007,8 @@ is_printer_active (GtkTreeModel *model,
GtkPrinter *printer;
GtkPrintUnixDialogPrivate *priv = dialog->priv;
- gtk_tree_model_get (model,
- iter,
- PRINTER_LIST_COL_PRINTER_OBJ,
- &printer,
+ gtk_tree_model_get (model, iter,
+ PRINTER_LIST_COL_PRINTER_OBJ, &printer,
-1);
if (printer == NULL)
@@ -1082,8 +1078,10 @@ default_printer_list_sort_func (GtkTreeModel *model,
g_free (a_name);
g_free (b_name);
- g_object_unref (a_printer);
- g_object_unref (b_printer);
+ if (a_printer)
+ g_object_unref (a_printer);
+ if (b_printer)
+ g_object_unref (b_printer);
return result;
}