# HG changeset patch
# Node ID 22d0892e22ca
# Parent  ec8b76f3bf0a
diff --git a/libpurple/accounts.c b/libpurple/accounts.c
--- a/libpurple/accounts.c
+++ b/libpurple/accounts.c
@@ -573,7 +573,7 @@
 		purple_debug_warning("accounts",
 		                     "Failed to remove password for account %s: %s",
 		                     purple_account_get_name_for_display(account),
-		                     error->message);
+		                     (error != NULL) ? error->message : "Unknown error");
 
 		g_clear_error(&error);
 	}
diff --git a/libpurple/plugins/keyrings/secretservice.c b/libpurple/plugins/keyrings/secretservice.c
--- a/libpurple/plugins/keyrings/secretservice.c
+++ b/libpurple/plugins/keyrings/secretservice.c
@@ -123,14 +123,18 @@
 {
 	GTask *task = G_TASK(data);
 	GError *error = NULL;
-	gboolean ret = FALSE;
 
-	ret = secret_password_clear_finish(result, &error);
+	/* This returns whether a password was removed or not. Which means that it
+	 * can return FALSE with error unset. This would complicate all of the other
+	 * credential API and we don't need to make this distinction, so we just
+	 * return TRUE unless error is set.
+	 */
+	secret_password_clear_finish(result, &error);
 
 	if(error != NULL) {
 		g_task_return_error(task, error);
 	} else {
-		g_task_return_boolean(task, ret);
+		g_task_return_boolean(task, TRUE);
 	}
 
 	g_object_unref(G_OBJECT(task));
diff --git a/libpurple/plugins/keyrings/wincred.c b/libpurple/plugins/keyrings/wincred.c
--- a/libpurple/plugins/keyrings/wincred.c
+++ b/libpurple/plugins/keyrings/wincred.c
@@ -292,28 +292,26 @@
 		DWORD error_code = GetLastError();
 
 		if (error_code == ERROR_NOT_FOUND) {
-			if (purple_debug_is_verbose()) {
-				purple_debug_misc(
+			/* If there was no password we just return TRUE. */
+			g_task_return_boolean(task, TRUE);
+		} else {
+			if (error_code == ERROR_NO_SUCH_LOGON_SESSION) {
+				purple_debug_error(
 				        "keyring-wincred",
-				        "Password for account %s was already removed.",
-				        purple_account_get_username(account));
+				        "Cannot remove password, no valid logon session");
+				error = g_error_new(
+				        PURPLE_WINCRED_ERROR, error_code,
+				        _("Cannot remove password, no valid logon session."));
+			} else {
+				purple_debug_error("keyring-wincred",
+				                   "Cannot remove password, error %lx", error_code);
+				error = g_error_new(
+				        PURPLE_WINCRED_ERROR, error_code,
+				        _("Cannot remove password (error %lx)."), error_code);
 			}
-		} else if (error_code == ERROR_NO_SUCH_LOGON_SESSION) {
-			purple_debug_error(
-			        "keyring-wincred",
-			        "Cannot remove password, no valid logon session");
-			error = g_error_new(
-			        PURPLE_WINCRED_ERROR, error_code,
-			        _("Cannot remove password, no valid logon session."));
-		} else {
-			purple_debug_error("keyring-wincred",
-			                   "Cannot remove password, error %lx", error_code);
-			error = g_error_new(
-			        PURPLE_WINCRED_ERROR, error_code,
-			        _("Cannot remove password (error %lx)."), error_code);
+
+			g_task_return_error(task, error);
 		}
-
-		g_task_return_error(task, error);
 	}
 
 	g_object_unref(G_OBJECT(task));
diff --git a/libpurple/purplecredentialmanager.h b/libpurple/purplecredentialmanager.h
--- a/libpurple/purplecredentialmanager.h
+++ b/libpurple/purplecredentialmanager.h
@@ -270,8 +270,8 @@
  * Finishes a previous call to
  * purple_credential_provider_clear_password_async().
  *
- * Returns: %TRUE if the password was cleared successfully, otherwise %FALSE
- *          with @error set.
+ * Returns: %TRUE if the password didn't exist or was cleared successfully,
+ *          otherwise %FALSE with @error set.
  *
  * Since: 3.0.0
  */
diff --git a/libpurple/purplecredentialprovider.h b/libpurple/purplecredentialprovider.h
--- a/libpurple/purplecredentialprovider.h
+++ b/libpurple/purplecredentialprovider.h
@@ -269,8 +269,8 @@
  * Finishes a previous call to
  * purple_credential_provider_clear_password_async().
  *
- * Returns: %TRUE if the password was cleared successfully, otherwise %FALSE
- *          with @error set.
+ * Returns: %TRUE if the password didn't exist or was cleared successfully,
+ *          otherwise %FALSE with @error set.
  *
  * Since: 3.0.0
  */
