[gtk+/font-chooser] Clean up error handling



commit 541a2c3efb08c47765e302bc7aa0eb6d86305c07
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 9 02:11:38 2011 +0200

    Clean up error handling

 gtk/gtkfontchooser.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index 60c71c6..4d2e514 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -429,10 +429,13 @@ cursor_changed_cb (GtkTreeView *treeview,
   gtk_tree_path_free (path);
   path = NULL;
 
-  if (!face || !family)
+  if (face == NULL || family == NULL)
     {
-      g_object_unref (face);
-      g_object_unref (family);
+      if (face)
+        g_object_unref (face);
+      if (family)
+        g_object_unref (family);
+
       return;
     }
 
@@ -450,10 +453,9 @@ cursor_changed_cb (GtkTreeView *treeview,
   gtk_font_chooser_set_family (fontchooser, family);
   gtk_font_chooser_set_face   (fontchooser, face);
 
-  /* Free resources */
-  g_object_unref ((gpointer)family);
-  g_object_unref ((gpointer)face);
-  pango_font_description_free(desc);
+  g_object_unref (family);
+  g_object_unref (face);
+  pango_font_description_free (desc);
 
   g_object_notify (G_OBJECT (fontchooser), "font-name");
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]