[epiphany/mcatanzaro/#1773: 4/4] password-manager: remove g_warn_if_reached()




commit f168e4dbe21eed4227be719f6335264be9b5ef9b
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Fri May 6 17:39:34 2022 -0500

    password-manager: remove g_warn_if_reached()
    
    If there is a bug, we'd better crash so that we get bug reports and good
    backtraces, rather than just print a warning that doesn't help much.

 lib/sync/ephy-password-manager.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 293b37e2a..a510953ab 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -804,14 +804,11 @@ forget_cb (GList    *records,
   EphyPasswordManager *self = EPHY_PASSWORD_MANAGER (g_task_get_source_object (task));
   EphyPasswordRecord *record;
 
-  /* We expect only one matching record here. */
-  if (g_list_length (records) == 1) {
-    record = EPHY_PASSWORD_RECORD (records->data);
-    g_signal_emit_by_name (self, "synchronizable-deleted", record);
-    ephy_password_manager_forget_record (self, record, NULL, task);
-  } else {
-    g_warn_if_reached ();
-  }
+  g_assert (g_list_length (records) == 1);
+
+  record = EPHY_PASSWORD_RECORD (records->data);
+  g_signal_emit_by_name (self, "synchronizable-deleted", record);
+  ephy_password_manager_forget_record (self, record, NULL, task);
 }
 
 gboolean
@@ -941,12 +938,9 @@ replace_existing_cb (GList    *records,
 {
   ManageRecordAsyncData *data = (ManageRecordAsyncData *)user_data;
 
-  /* We expect only one matching record here. */
-  if (g_list_length (records) == 1)
-    ephy_password_manager_forget_record (data->manager, records->data, data->record, NULL);
-  else
-    g_warn_if_reached ();
+  g_assert (g_list_length (records) == 1);
 
+  ephy_password_manager_forget_record (data->manager, records->data, data->record, NULL);
   manage_record_async_data_free (data);
 }
 


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