seahorse r2425 - in seahorse-plugins/trunk: . agent



Author: nnielsen
Date: Mon Sep  1 17:16:30 2008
New Revision: 2425
URL: http://svn.gnome.org/viewvc/seahorse?rev=2425&view=rev

Log:
	* agent/seahorse-agent-actions.c:
	* agent/seahorse-agent-io.c:
	* agent/seahorse-agent-prompt.c:
	* agent/seahorse-agent-status.c: Don't g_assert conditions not controlled
	directly by nearby code. Otherwise the agent can be caused to abort 
	for missing glade files for example.


Modified:
   seahorse-plugins/trunk/ChangeLog
   seahorse-plugins/trunk/agent/seahorse-agent-actions.c
   seahorse-plugins/trunk/agent/seahorse-agent-io.c
   seahorse-plugins/trunk/agent/seahorse-agent-prompt.c
   seahorse-plugins/trunk/agent/seahorse-agent-status.c

Modified: seahorse-plugins/trunk/agent/seahorse-agent-actions.c
==============================================================================
--- seahorse-plugins/trunk/agent/seahorse-agent-actions.c	(original)
+++ seahorse-plugins/trunk/agent/seahorse-agent-actions.c	Mon Sep  1 17:16:30 2008
@@ -92,7 +92,7 @@
     const gchar *pass;
     gchar *enc;
 
-    g_assert (rq != NULL);
+    g_return_if_fail (rq != NULL);
 
     if (id && !seahorse_gconf_get_boolean (SETTING_AUTH)) {
         /* 
@@ -150,7 +150,7 @@
 {
     const gchar *pass = NULL;
 
-    g_assert (pr != NULL);
+    g_return_if_fail (pr != NULL);
 
     if (authorized) {
         /* 
@@ -158,9 +158,9 @@
          * time we arrive here. The code that checks that the password
          * exists also locks it into the cache.
          */
-        g_assert (pr->id);
+        g_return_if_fail (pr->id);
         pass = seahorse_agent_cache_get (pr->id);
-        g_assert (pass != NULL);
+        g_return_if_fail (pass != NULL);
     }
 
     seahorse_agent_actions_donepass (pr, pass);
@@ -195,7 +195,7 @@
 {
     SeahorseAgentPassReq *pr;
 
-    g_assert (g_queue != NULL);
+    g_return_if_fail (g_queue != NULL);
 
     /* If we already have some gui thing going on, then wait */
     if (seahorse_agent_prompt_have ())

Modified: seahorse-plugins/trunk/agent/seahorse-agent-io.c
==============================================================================
--- seahorse-plugins/trunk/agent/seahorse-agent-io.c	(original)
+++ seahorse-plugins/trunk/agent/seahorse-agent-io.c	Mon Sep  1 17:16:30 2008
@@ -647,8 +647,8 @@
     SeahorseAgentConn *cn;
     int fd;
 
-    g_assert (source);
-    g_assert (cond == G_IO_IN);
+    g_return_val_if_fail (source, FALSE);
+    g_return_val_if_fail (cond == G_IO_IN, FALSE);
 
     fd = accept (g_io_channel_unix_get_fd (source), NULL, NULL);
     if (fd < 0) {

Modified: seahorse-plugins/trunk/agent/seahorse-agent-prompt.c
==============================================================================
--- seahorse-plugins/trunk/agent/seahorse-agent-prompt.c	(original)
+++ seahorse-plugins/trunk/agent/seahorse-agent-prompt.c	Mon Sep  1 17:16:30 2008
@@ -116,13 +116,13 @@
 {
     const gchar *pass = NULL;
     
-    g_assert (g_current_win);
+    g_return_if_fail (g_current_win);
     gtk_widget_destroy (g_current_win);
     g_current_win = NULL;
 
     if (ok) {
         pass = seahorse_agent_cache_get (pr->id);
-        g_assert (pass);
+        g_return_if_fail (pass);
     }
 
     seahorse_agent_actions_donepass (pr, pass);
@@ -151,7 +151,7 @@
 {
     GtkDialog *dialog;
 
-    g_assert (!seahorse_agent_prompt_have ());
+    g_return_if_fail (!seahorse_agent_prompt_have ());
     
     dialog = seahorse_passphrase_prompt_show (NULL, pr->errmsg ? pr->errmsg : pr->description, 
                                               pr->prompt, NULL, FALSE);
@@ -168,7 +168,7 @@
 static void
 auth_done_dialog (SeahorseAgentPassReq *pr, gboolean ok)
 {
-    g_assert (g_current_win);
+    g_return_if_fail (g_current_win);
     gtk_widget_destroy (g_current_win);
     g_current_win = NULL;
 
@@ -290,6 +290,6 @@
 void
 seahorse_agent_prompt_auth (SeahorseAgentPassReq *pr)
 {
-    g_assert (!seahorse_agent_prompt_have ());
+    g_return_if_fail (!seahorse_agent_prompt_have ());
     g_current_win = create_auth_window (pr);
 }

Modified: seahorse-plugins/trunk/agent/seahorse-agent-status.c
==============================================================================
--- seahorse-plugins/trunk/agent/seahorse-agent-status.c	(original)
+++ seahorse-plugins/trunk/agent/seahorse-agent-status.c	Mon Sep  1 17:16:30 2008
@@ -123,9 +123,9 @@
     GtkTreeStore *store;
     GtkTreeView *tree;
     
-    g_assert (g_window != NULL);
+    g_return_if_fail (g_window != NULL);
     tree = GTK_TREE_VIEW (glade_xml_get_widget (g_window->xml, "key_list"));
-    g_assert (tree != NULL);
+    g_return_if_fail (tree != NULL);
 
     store = GTK_TREE_STORE (gtk_tree_view_get_model (tree));
     if (!store) {



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