[dialog-sx-since-last-run] don't allocate repeatedly to combine strings

This commit is contained in:
Christopher Lam 2021-10-19 23:47:15 +08:00
parent b5f5129f7d
commit 7a25c12b9a

View File

@ -43,6 +43,7 @@
#include "gnc-prefs.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnc-glib-utils.h"
#include "Query.h"
#include "qof.h"
#include "gnc-ledger-display.h"
@ -807,22 +808,11 @@ gnc_sx_slr_tree_model_adapter_new (GncSxInstanceModel *instances)
static void
creation_error_dialog (GList **creation_errors)
{
GList *node = *creation_errors;
GtkWidget *dialog = NULL;
gchar *message = NULL;
if (*creation_errors == NULL) return;
for(; node != NULL; node = g_list_next (node))
{
gchar *new_msg = NULL;
if (message == NULL)
new_msg = g_strdup_printf ("%s", (gchar*)(node->data));
else
new_msg = g_strdup_printf ("%s\n%s", message, (gchar*)(node->data));
g_free (message);
message = new_msg;
g_free (node->data);
}
g_list_free (*creation_errors);
message = gnc_g_list_stringjoin (*creation_errors, "\n");
g_list_free_full (*creation_errors, g_free);
creation_errors = NULL;
dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,