gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Wed May 17 22:58:27 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/5563d535 (commit)
via https://github.com/Gnucash/gnucash/commit/8ccc6da8 (commit)
via https://github.com/Gnucash/gnucash/commit/b09fe481 (commit)
via https://github.com/Gnucash/gnucash/commit/74e5f87c (commit)
via https://github.com/Gnucash/gnucash/commit/848f4eb8 (commit)
via https://github.com/Gnucash/gnucash/commit/d36cf217 (commit)
via https://github.com/Gnucash/gnucash/commit/81fba56b (commit)
via https://github.com/Gnucash/gnucash/commit/bed43c7f (commit)
via https://github.com/Gnucash/gnucash/commit/dc629595 (commit)
from https://github.com/Gnucash/gnucash/commit/26162da4 (commit)
commit 5563d535171f11b3a3a367d236341fd240c5df80
Merge: 8ccc6da87e b09fe48176
Author: John Ralls <jralls at ceridwen.us>
Date: Wed May 17 21:56:11 2023 -0500
Merge Richard Cohen's 'remove-unneeded-code' into stable.
commit 8ccc6da87ea571be7181ee5ec4c7355cb4126b6d
Merge: 26162da450 81fba56bbb
Author: John Ralls <jralls at ceridwen.us>
Date: Wed May 17 21:20:44 2023 -0500
Merge Richard Cohen's 'fix-test-engine-crash' into stable.
commit b09fe48176fbfe556dcd7f9596d0afa45f31e9f0
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Wed May 17 13:48:36 2023 +0100
Remove unused GnucashItemCursor
diff --git a/gnucash/register/register-gnome/gnucash-cursor.h b/gnucash/register/register-gnome/gnucash-cursor.h
index 092e07f06f..232434b31e 100644
--- a/gnucash/register/register-gnome/gnucash-cursor.h
+++ b/gnucash/register/register-gnome/gnucash-cursor.h
@@ -36,13 +36,6 @@
#define GNUCASH_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_CURSOR, GnucashCursorClass))
#define GNUCASH_IS_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNUCASH_TYPE_CURSOR))
-#define GNUCASH_TYPE_ITEM_CURSOR (gnucash_item_cursor_get_type ())
-#define GNUCASH_ITEM_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_ITEM_CURSOR, GnucashItemCursor))
-#define GNUCASH_ITEM_CURSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_ITEM_CURSOR, GnucashItemCursorClass))
-#define GNUCASH_IS_ITEM_CURSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNUCASH_TYPE_ITEM_CURSOR))
-
-
-GType gnucash_item_cursor_get_type (void);
GType gnucash_cursor_get_type (void);
commit 74e5f87c69276a327fd782e08d4031c69545c682
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Thu May 11 16:04:17 2023 +0100
Remove unused signal GNCSplitReg::include-date
- time64 is NOT an int
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index 0dbec224be..8976e5153f 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -124,7 +124,6 @@ static void gsr_default_doclink_from_sheet_handler ( GNCSplitReg *w );
static void gsr_emit_simple_signal ( GNCSplitReg *gsr, const char *sigName );
static void gsr_emit_help_changed ( GnucashRegister *reg, gpointer user_data );
static void gsr_emit_show_popup_menu ( GnucashRegister *reg, gpointer user_data );
-static void gsr_emit_include_date_signal ( GNCSplitReg *gsr, time64 date );
void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
@@ -269,13 +268,12 @@ gnc_split_reg_class_init( GNCSplitRegClass *klass )
{ REVERSE_TXN_SIGNAL, "reverse_txn", G_STRUCT_OFFSET( GNCSplitRegClass, reverse_txn_cb ) },
{ HELP_CHANGED_SIGNAL, "help-changed", G_STRUCT_OFFSET( GNCSplitRegClass, help_changed_cb ) },
{ SHOW_POPUP_MENU_SIGNAL, "show-popup-menu", G_STRUCT_OFFSET( GNCSplitRegClass, show_popup_menu_cb ) },
- { INCLUDE_DATE_SIGNAL, "include-date", G_STRUCT_OFFSET( GNCSplitRegClass, include_date_cb ) },
{ LAST_SIGNAL, NULL, 0 }
};
object_class = (GObjectClass*) klass;
- for ( i = 0; signals[i].s != INCLUDE_DATE_SIGNAL; i++ )
+ for ( i = 0; signals[i].s != LAST_SIGNAL; i++ )
{
gnc_split_reg_signals[ signals[i].s ] =
g_signal_new( signals[i].signal_name,
@@ -286,18 +284,6 @@ gnc_split_reg_class_init( GNCSplitRegClass *klass )
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0 );
}
- /* Setup the non-default-marshalled signals; 'i' is still valid, here. */
- /* "include-date" */
- gnc_split_reg_signals[ INCLUDE_DATE_SIGNAL ] =
- g_signal_new( "include-date",
- G_TYPE_FROM_CLASS(object_class),
- G_SIGNAL_RUN_LAST,
- signals[i++].defaultOffset,
- NULL, NULL,
- g_cclosure_marshal_VOID__INT, /* time64 == int */
- G_TYPE_NONE, 1, G_TYPE_INT );
-
- g_assert( i == LAST_SIGNAL );
/* Setup the default handlers. */
klass->enter_ent_cb = gsr_default_enter_handler;
@@ -321,7 +307,6 @@ gnc_split_reg_class_init( GNCSplitRegClass *klass )
klass->help_changed_cb = NULL;
klass->show_popup_menu_cb = NULL;
- klass->include_date_cb = NULL;
object_class->dispose = gnc_split_reg_dispose;
}
@@ -1736,18 +1721,11 @@ gnc_split_reg_clear_filter_for_split (GNCSplitReg *gsr, Split *split)
void
gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split)
{
- Transaction *trans;
- VirtualCellLocation vcell_loc;
- SplitRegister *reg;
-
if (!gsr) return;
- trans = xaccSplitGetParent(split);
-
- gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
- reg = gnc_ledger_display_get_split_register( gsr->ledger );
+ SplitRegister *reg = gnc_ledger_display_get_split_register( gsr->ledger );
+ VirtualCellLocation vcell_loc;
if (gnc_split_register_get_split_virt_loc(reg, split, &vcell_loc))
gnucash_register_goto_virt_cell( gsr->reg, vcell_loc );
@@ -1760,17 +1738,11 @@ gnc_split_reg_jump_to_split(GNCSplitReg *gsr, Split *split)
void
gnc_split_reg_jump_to_split_amount(GNCSplitReg *gsr, Split *split)
{
- VirtualLocation virt_loc;
- SplitRegister *reg;
- Transaction *trans;
-
if (!gsr) return;
- trans = xaccSplitGetParent(split);
- gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
- reg = gnc_ledger_display_get_split_register (gsr->ledger);
+ SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
+ VirtualLocation virt_loc;
if (gnc_split_register_get_split_amount_virt_loc (reg, split, &virt_loc))
gnucash_register_goto_virt_loc (gsr->reg, virt_loc);
@@ -2165,13 +2137,9 @@ gnc_split_reg_set_sort_reversed(GNCSplitReg *gsr, gboolean rev, gboolean refresh
static gboolean
gnc_split_reg_record (GNCSplitReg *gsr)
{
- SplitRegister *reg;
- Transaction *trans;
-
ENTER("gsr=%p", gsr);
- reg = gnc_ledger_display_get_split_register (gsr->ledger);
- trans = gnc_split_register_get_current_trans (reg);
+ SplitRegister *reg = gnc_ledger_display_get_split_register (gsr->ledger);
if (!gnc_split_register_save (reg, TRUE))
{
@@ -2179,8 +2147,6 @@ gnc_split_reg_record (GNCSplitReg *gsr)
return FALSE;
}
- gsr_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
/* Explicit redraw shouldn't be needed,
* since gui_refresh events should handle this. */
/* gnc_split_register_redraw (reg); */
@@ -2591,13 +2557,6 @@ gsr_emit_show_popup_menu( GnucashRegister *reg, gpointer user_data )
gsr_emit_simple_signal( (GNCSplitReg*)user_data, "show-popup-menu" );
}
-static
-void
-gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date )
-{
- g_signal_emit_by_name( gsr, "include-date", date, NULL );
-}
-
static
void
gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName )
diff --git a/gnucash/gnome/gnc-split-reg.h b/gnucash/gnome/gnc-split-reg.h
index c1fcb5a081..9950a528f6 100644
--- a/gnucash/gnome/gnc-split-reg.h
+++ b/gnucash/gnome/gnc-split-reg.h
@@ -123,7 +123,6 @@ struct _GNCSplitRegClass
void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data );
void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data );
void (*show_popup_menu_cb) ( GNCSplitReg *w, gpointer user_data );
- void (*include_date_cb) ( GNCSplitReg *w, time64 date, gpointer user_data );
};
/* Something somewhere sets these to silly values and causes problems */
#undef DELETE
commit 848f4eb81df0c4b692a17ae23ce320ecf8fa4a30
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sun May 7 13:28:11 2023 +0100
Remove unused GNCDateDelta
diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
index 7839eb27b8..9cf7b12266 100644
--- a/gnucash/gnome-utils/CMakeLists.txt
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -59,7 +59,6 @@ set (gnome_utils_SOURCES
gnc-commodity-edit.c
gnc-component-manager.c
gnc-currency-edit.c
- gnc-date-delta.c
gnc-date-edit.c
gnc-date-format.c
gnc-dense-cal.c
@@ -149,7 +148,6 @@ set (gnome_utils_HEADERS
gnc-commodity-edit.h
gnc-component-manager.h
gnc-currency-edit.h
- gnc-date-delta.h
gnc-date-edit.h
gnc-date-format.h
gnc-dense-cal.h
diff --git a/gnucash/gnome-utils/gnc-date-delta.c b/gnucash/gnome-utils/gnc-date-delta.c
deleted file mode 100644
index 20407ad3d7..0000000000
--- a/gnucash/gnome-utils/gnc-date-delta.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * gnc-datedelta.c -- Date delta widget
- *
- * Copyright (C) 2000 Free Software Foundation
- * All rights reserved.
- *
- * Gnucash is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Gnucash is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, contact:
- *
- * Free Software Foundation Voice: +1-617-542-5942
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- *
- */
-/*
- @NOTATION@
- */
-
-/*
- * Date delta widget
- *
- * Author: Dave Peticolas <peticola at cs.ucdavis.edu>
- */
-
-#include <config.h>
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <string.h>
-#include <stdlib.h> /* atoi */
-#include <ctype.h> /* isdigit */
-#include <stdio.h>
-
-#include "gnc-date.h"
-#include "gnc-date-delta.h"
-#include "dialog-utils.h"
-
-#define GDD_LABEL "gdd"
-
-enum
-{
- VALUE_CHANGED,
- UNITS_CHANGED,
- POLARITY_CHANGED,
- DELTA_CHANGED,
- LAST_SIGNAL
-};
-
-static guint date_delta_signals [LAST_SIGNAL] = { 0 };
-
-
-static void gnc_date_delta_init (GNCDateDelta *gdd);
-static void gnc_date_delta_class_init (GNCDateDeltaClass *klass);
-static void gnc_date_delta_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callbabck_data);
-
-static GtkBoxClass *parent_class;
-
-/**
- * gnc_date_delta_get_type:
- *
- * Returns the GType for the GNCDateDelta widget
- */
-GType
-gnc_date_delta_get_type (void)
-{
- static GType date_delta_type = 0;
-
- if (date_delta_type == 0)
- {
- GTypeInfo date_delta_info =
- {
- sizeof (GNCDateDeltaClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_date_delta_class_init,
- NULL,
- NULL,
- sizeof (GNCDateDelta),
- 0,
- (GInstanceInitFunc) gnc_date_delta_init
- };
-
- date_delta_type = g_type_register_static (gtk_box_get_type (),
- "GNCDateDelta",
- &date_delta_info,
- 0);
- }
-
- return date_delta_type;
-}
-
-static void
-gnc_date_delta_class_init (GNCDateDeltaClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- date_delta_signals [VALUE_CHANGED] =
- g_signal_new ("value_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCDateDeltaClass, value_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- date_delta_signals [UNITS_CHANGED] =
- g_signal_new ("units_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCDateDeltaClass, units_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- date_delta_signals [POLARITY_CHANGED] =
- g_signal_new ("polarity_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCDateDeltaClass, polarity_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- date_delta_signals [DELTA_CHANGED] =
- g_signal_new ("delta_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GNCDateDeltaClass, delta_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- container_class->forall = gnc_date_delta_forall;
-}
-
-static void
-gnc_date_delta_init (GNCDateDelta *gdd)
-{
- gtk_orientable_set_orientation (GTK_ORIENTABLE(gdd), GTK_ORIENTATION_HORIZONTAL);
-
- // Set the name for this widget so it can be easily manipulated with css
- gtk_widget_set_name (GTK_WIDGET(gdd), "gnc-id-date-delta");
-
- gdd->value_spin = NULL;
- gdd->units_combo = NULL;
- gdd->polarity_combo = NULL;
-
- gdd->units = 0;
- gdd->polarity = 0;
-
- gdd->show_polarity = FALSE;
-}
-
-static void
-gnc_date_delta_forall (GtkContainer *container, gboolean include_internals,
- GtkCallback callback, gpointer callback_data)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GNC_IS_DATE_DELTA (container));
- g_return_if_fail (callback != NULL);
-
- /* Let GtkBox handle things only if the internal widgets need to be
- * poked.
- */
- if (include_internals)
- if (GTK_CONTAINER_CLASS (parent_class)->forall)
- (* GTK_CONTAINER_CLASS (parent_class)->forall)
- (container, include_internals, callback, callback_data);
-}
-
-static void
-value_changed(GtkEditable *editable, gpointer data)
-{
- GNCDateDelta *gdd = GNC_DATE_DELTA(data);
-
- g_signal_emit(gdd, date_delta_signals [VALUE_CHANGED], 0);
- g_signal_emit(gdd, date_delta_signals [DELTA_CHANGED], 0);
-}
-
-static void
-set_units (GtkComboBox *combo, GNCDateDelta *gdd)
-{
- gint active;
-
- active = gtk_combo_box_get_active(GTK_COMBO_BOX(gdd->units_combo));
- if ((active < GNC_DATE_DELTA_DAYS) || (active > GNC_DATE_DELTA_YEARS))
- active = GNC_DATE_DELTA_DAYS;
- gdd->units = active;
-
- g_signal_emit (gdd, date_delta_signals [UNITS_CHANGED], 0);
- g_signal_emit (gdd, date_delta_signals [DELTA_CHANGED], 0);
-}
-
-static void
-fill_units_combo(GNCDateDelta *gdd)
-{
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
- _("Days"));
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
- _("Weeks"));
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
- _("Months"));
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->units_combo),
- _("Years"));
-
- g_signal_connect (gdd->units_combo, "changed",
- G_CALLBACK (set_units), gdd);
-}
-
-static void
-set_polarity (GtkComboBox *combo, GNCDateDelta *gdd)
-{
- gint active;
-
- active = gtk_combo_box_get_active(GTK_COMBO_BOX(gdd->units_combo));
- if ((active < GNC_DATE_DELTA_PAST) || (active > GNC_DATE_DELTA_FUTURE))
- active = GNC_DATE_DELTA_PAST;
- gdd->polarity = active;
-
- g_signal_emit (gdd, date_delta_signals [POLARITY_CHANGED], 0);
- g_signal_emit (gdd, date_delta_signals [DELTA_CHANGED], 0);
-}
-
-static void
-fill_polarity_combo(GNCDateDelta *gdd)
-{
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->polarity_combo),
- _("Ago"));
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(gdd->polarity_combo),
- _("From Now"));
-
- g_signal_connect (gdd->polarity_combo, "changed",
- G_CALLBACK(set_polarity), gdd);
-}
-
-static void
-create_children (GNCDateDelta *gdd)
-{
- GInitiallyUnowned *adj;
-
- adj = G_INITIALLY_UNOWNED (gtk_adjustment_new(1.0, 1.0, 1000.0, 1.0, 5.0, 5.0));
- gdd->value_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1.0, 0);
- gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(gdd->value_spin), TRUE);
- gtk_box_pack_start(GTK_BOX(gdd), gdd->value_spin, FALSE, FALSE, 0);
- gtk_widget_show(gdd->value_spin);
-
- g_signal_connect(gdd->value_spin, "changed",
- G_CALLBACK(value_changed), gdd);
-
- gdd->units_combo = gtk_combo_box_text_new();
- fill_units_combo(gdd);
- gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->units_combo), 0);
- gtk_box_pack_start(GTK_BOX(gdd), gdd->units_combo, FALSE, FALSE, 0);
- gtk_widget_show(gdd->units_combo);
-
- gdd->polarity_combo = gtk_combo_box_text_new();
- fill_polarity_combo(gdd);
- gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->polarity_combo), 0);
- gtk_box_pack_start(GTK_BOX(gdd), gdd->polarity_combo, FALSE, FALSE, 0);
- if (gdd->show_polarity)
- gtk_widget_show(gdd->polarity_combo);
-}
-
-/**
- * gnc_date_delta_new:
- * @show_polarity: whether 'from now/ago' menu should be displayed.
- *
- * Creates a new GNCDateDelta widget which can be used to provide
- * an easy to use way for entering time deltas in terms of 7 days,
- * 5 weeks, 2 months, etc.
- *
- * Returns a GNCDateDelta widget.
- */
-GtkWidget *
-gnc_date_delta_new (gboolean show_polarity)
-{
- GNCDateDelta *gdd;
-
- gdd = g_object_new (gnc_date_delta_get_type (), NULL);
-
- gdd->show_polarity = show_polarity;
-
- create_children (gdd);
-
- return GTK_WIDGET (gdd);
-}
-
-/**
- * gnc_date_delta_set_value:
- * @gdd: The GNCDateDelta widget
- * @value: The value to set
- *
- * Changes the value of the delta widget to that given.
- */
-void
-gnc_date_delta_set_value (GNCDateDelta *gdd, int value)
-{
- g_return_if_fail(gdd != NULL);
- g_return_if_fail(GNC_IS_DATE_DELTA(gdd));
-
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(gdd->value_spin), value);
-}
-
-/**
- * gnc_date_delta_get_value:
- * @gdd: The GNCDateDelta widget
- *
- * Returns the value of the delta widget.
- */
-int
-gnc_date_delta_get_value (GNCDateDelta *gdd)
-{
- g_return_val_if_fail(gdd != NULL, 0);
- g_return_val_if_fail(GNC_IS_DATE_DELTA(gdd), 0);
-
- return gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(gdd->value_spin));
-}
-
-/**
- * gnc_date_delta_set_units:
- * @gdd: The GNCDateDelta widget
- * @units: The units to set
- *
- * Changes the units of the delta widget to that given.
- */
-void
-gnc_date_delta_set_units (GNCDateDelta *gdd, GNCDateDeltaUnits units)
-{
- g_return_if_fail(gdd != NULL);
- g_return_if_fail(GNC_IS_DATE_DELTA(gdd));
- g_return_if_fail((units >= 0) && (units < GNC_DATE_DELTA_NUM_UNITS));
-
- gdd->units = units;
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->units_combo), units);
-}
-
-/**
- * gnc_date_delta_get_units:
- * @gdd: The GNCDateDelta widget
- *
- * Returns the units of the delta widget.
- */
-GNCDateDeltaUnits
-gnc_date_delta_get_units (GNCDateDelta *gdd)
-{
- g_return_val_if_fail(gdd != NULL, GNC_DATE_DELTA_DAYS);
- g_return_val_if_fail(GNC_IS_DATE_DELTA(gdd), GNC_DATE_DELTA_DAYS);
-
- return gdd->units;
-}
-
-/**
- * gnc_date_delta_set_polarity:
- * @gdd: The GNCDateDelta widget
- * @polarity: The polarity to set
- *
- * Changes the polarity of the delta widget to that given.
- */
-void
-gnc_date_delta_set_polarity (GNCDateDelta *gdd, GNCDateDeltaPolarity polarity)
-{
- g_return_if_fail(gdd != NULL);
- g_return_if_fail(GNC_IS_DATE_DELTA(gdd));
- g_return_if_fail((polarity >= 0) &&
- (polarity < GNC_DATE_DELTA_NUM_POLARITY));
-
- gdd->polarity = polarity;
-
- gtk_combo_box_set_active(GTK_COMBO_BOX(gdd->polarity_combo), polarity);
-}
-
-/**
- * gnc_date_delta_get_polarity:
- * @gdd: The GNCDateDelta widget
- *
- * Returns the polarity of the delta widget.
- */
-GNCDateDeltaPolarity
-gnc_date_delta_get_polarity (GNCDateDelta *gdd)
-{
- g_return_val_if_fail(gdd != NULL, GNC_DATE_DELTA_PAST);
- g_return_val_if_fail(GNC_IS_DATE_DELTA(gdd), GNC_DATE_DELTA_PAST);
-
- return gdd->polarity;
-}
-
-/**
- * gnc_date_delta_show_polarity:
- * @gdd: The GNCDateDelta widget
- * @show_polarity: boolean flag
- *
- * Show/hide the polarity menu.
- */
-void
-gnc_date_delta_show_polarity (GNCDateDelta *gdd, gboolean show_polarity)
-{
- g_return_if_fail(gdd != NULL);
- g_return_if_fail(GNC_IS_DATE_DELTA(gdd));
-
- gdd->show_polarity = show_polarity;
-
- if (show_polarity)
- gtk_widget_show(gdd->polarity_combo);
- else
- gtk_widget_hide(gdd->polarity_combo);
-}
diff --git a/gnucash/gnome-utils/gnc-date-delta.h b/gnucash/gnome-utils/gnc-date-delta.h
deleted file mode 100644
index f749747ddb..0000000000
--- a/gnucash/gnome-utils/gnc-date-delta.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * gnc-datedelta.h -- Date delta widget
- *
- * Copyright (C) 2000 Free Software Foundation
- * All rights reserved.
- *
- * Author: Dave Peticolas <peticola at cs.ucdavis.edu>
- *
- * GnuCash is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * Gnucash is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, contact:
- *
- * Free Software Foundation Voice: +1-617-542-5942
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- *
- */
-/*
- @NOTATION@
- */
-
-#ifndef GNC_DATE_DELTA_H
-#define GNC_DATE_DELTA_H
-
-typedef enum
-{
- GNC_DATE_DELTA_DAYS,
- GNC_DATE_DELTA_WEEKS,
- GNC_DATE_DELTA_MONTHS,
- GNC_DATE_DELTA_YEARS,
- GNC_DATE_DELTA_NUM_UNITS
-} GNCDateDeltaUnits;
-
-typedef enum
-{
- GNC_DATE_DELTA_PAST,
- GNC_DATE_DELTA_FUTURE,
- GNC_DATE_DELTA_NUM_POLARITY
-} GNCDateDeltaPolarity;
-
-#define GNC_TYPE_DATE_DELTA (gnc_date_delta_get_type())
-#define GNC_DATE_DELTA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_DATE_DELTA , GNCDateDelta)
-#define GNC_DATE_DELTA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_DATE_DELTA, GNCDateDeltaClass)
-#define GNC_IS_DATE_DELTA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_DATE_DELTA)
-
-typedef struct
-{
- GtkBox hbox;
-
- GtkWidget *value_spin;
- GtkWidget *units_combo;
- GtkWidget *polarity_combo;
-
- GNCDateDeltaUnits units;
- GNCDateDeltaPolarity polarity;
-
- gboolean show_polarity;
-} GNCDateDelta;
-
-typedef struct
-{
- GtkBoxClass parent_class;
- void (*value_changed) (GNCDateDelta *gdd);
- void (*units_changed) (GNCDateDelta *gdd);
- void (*polarity_changed) (GNCDateDelta *gdd);
- void (*delta_changed) (GNCDateDelta *gdd);
-} GNCDateDeltaClass;
-
-GType gnc_date_delta_get_type (void);
-
-GtkWidget *gnc_date_delta_new (gboolean show_polarity);
-
-void gnc_date_delta_set_value (GNCDateDelta *gdd, int value);
-int gnc_date_delta_get_value (GNCDateDelta *gdd);
-
-void gnc_date_delta_set_units (GNCDateDelta *gdd, GNCDateDeltaUnits units);
-GNCDateDeltaUnits gnc_date_delta_get_units (GNCDateDelta *gdd);
-
-void gnc_date_delta_set_polarity (GNCDateDelta *gdd,
- GNCDateDeltaPolarity polarity);
-GNCDateDeltaPolarity gnc_date_delta_get_polarity (GNCDateDelta *gdd);
-
-void gnc_date_delta_show_polarity (GNCDateDelta *gdd, gboolean show_polarity);
-
-#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 6ddf60c869..6f34e5f9a5 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -158,7 +158,6 @@ gnucash/gnome-utils/gnc-cell-view.c
gnucash/gnome-utils/gnc-commodity-edit.c
gnucash/gnome-utils/gnc-component-manager.c
gnucash/gnome-utils/gnc-currency-edit.c
-gnucash/gnome-utils/gnc-date-delta.c
gnucash/gnome-utils/gnc-date-edit.c
gnucash/gnome-utils/gnc-date-format.c
gnucash/gnome-utils/gnc-dense-cal.c
commit d36cf2177e257ea0b81dedf7d6324035c9143b5f
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri Mar 10 15:20:28 2023 +0000
Remove action callbacks that simply set the state
- it is the default behaviour
diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index 00f21c1992..7db7a5b0ee 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -276,22 +276,6 @@ GNC_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_APPLICATION_W
* code. */
static guint main_window_signals[LAST_SIGNAL] = { 0 };
-static void
-toggle_change_state (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
-static void
-radio_change_state (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
/** An array of all of the actions provided by the main window code.
* This includes some placeholder actions for the menus that are
* visible in the menu bar but have no action associated with
@@ -317,10 +301,10 @@ static GActionEntry gnc_menu_actions [] =
{ "ViewSortByAction", nullptr, nullptr, nullptr, nullptr },
{ "ViewFilterByAction", nullptr, nullptr, nullptr, nullptr },
{ "ViewRefreshAction", gnc_main_window_cmd_view_refresh, nullptr, nullptr, nullptr },
- { "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", toggle_change_state },
- { "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", toggle_change_state },
- { "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", toggle_change_state },
- { "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", radio_change_state },
+ { "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", nullptr },
+ { "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", nullptr },
+ { "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", nullptr },
+ { "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", nullptr },
{ "ScheduledAction", nullptr, nullptr, nullptr, nullptr },
@@ -329,7 +313,7 @@ static GActionEntry gnc_menu_actions [] =
{ "WindowNewAction", gnc_main_window_cmd_window_new, nullptr, nullptr, nullptr },
{ "WindowMovePageAction", gnc_main_window_cmd_window_move_page, nullptr, nullptr, nullptr },
#ifndef MAC_INTEGRATION
- { "WindowAction", gnc_main_window_cmd_window_raise, "i", "@i 0", radio_change_state },
+ { "WindowAction", gnc_main_window_cmd_window_raise, "i", "@i 0", nullptr },
#endif
{ "HelpTutorialAction", gnc_main_window_cmd_help_tutorial, nullptr, nullptr, nullptr },
{ "HelpContentsAction", gnc_main_window_cmd_help_contents, nullptr, nullptr, nullptr },
diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
index a9caf9e877..3b32accdb1 100644
--- a/gnucash/gnome/gnc-plugin-page-invoice.c
+++ b/gnucash/gnome/gnc-plugin-page-invoice.c
@@ -96,15 +96,6 @@ static void gnc_plugin_page_invoice_cmd_edit_tax (GSimpleAction *simple, GVarian
static void gnc_plugin_page_redraw_help_cb (GnucashRegister *gsr, GncPluginPageInvoice *invoice_page);
static void gnc_plugin_page_invoice_refresh_cb (GHashTable *changes, gpointer user_data);
-
-static void
-radio_change_state (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
/************************************************************
* Actions *
************************************************************/
@@ -135,7 +126,7 @@ static GActionEntry gnc_plugin_page_invoice_actions [] =
{ "BusinessLinkOpenAction", gnc_plugin_page_invoice_cmd_link_open, NULL, NULL, NULL },
{ "ToolsProcessPaymentAction", gnc_plugin_page_invoice_cmd_pay_invoice, NULL, NULL, NULL },
{ "ReportsCompanyReportAction", gnc_plugin_page_invoice_cmd_company_report, NULL, NULL, NULL },
- { "SortOrderRadioAction", gnc_plugin_page_invoice_cmd_sort_changed, "i", "@i 0", radio_change_state },
+ { "SortOrderRadioAction", gnc_plugin_page_invoice_cmd_sort_changed, "i", "@i 0", NULL },
};
static guint gnc_plugin_page_invoice_n_actions = G_N_ELEMENTS(gnc_plugin_page_invoice_actions);
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 937f7500ea..c1d51f62b0 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -243,22 +243,6 @@ static void gnc_plugin_page_register_event_handler (QofInstance* entity,
static GncInvoice* invoice_from_split (Split* split);
static GList* invoices_from_transaction (Transaction* trans);
-static void
-toggle_change_state (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
-static void
-radio_change_state (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
/************************************************************/
/* Actions */
/************************************************************/
@@ -341,9 +325,9 @@ static GActionEntry gnc_plugin_page_register_actions [] =
{ "ReportsAccountReportAction", gnc_plugin_page_register_cmd_account_report, NULL, NULL, NULL },
{ "ReportsAcctTransReportAction", gnc_plugin_page_register_cmd_transaction_report, NULL, NULL, NULL },
- { "ViewStyleDoubleLineAction", gnc_plugin_page_register_cmd_style_double_line, NULL, "false", toggle_change_state },
- { "SplitTransactionAction", gnc_plugin_page_register_cmd_expand_transaction, NULL, "false", toggle_change_state },
- { "ViewStyleRadioAction", gnc_plugin_page_register_cmd_style_changed, "i", "@i 0", radio_change_state },
+ { "ViewStyleDoubleLineAction", gnc_plugin_page_register_cmd_style_double_line, NULL, "false", NULL },
+ { "SplitTransactionAction", gnc_plugin_page_register_cmd_expand_transaction, NULL, "false", NULL },
+ { "ViewStyleRadioAction", gnc_plugin_page_register_cmd_style_changed, "i", "@i 0", NULL },
};
static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS(gnc_plugin_page_register_actions);
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
index 711425f69c..bf8254b69c 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
@@ -82,14 +82,6 @@ static void gnc_plugin_ab_cmd_aqb_import (GSimpleAction *simple, GVariant *param
#define MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW "ABViewLogwindowAction"
-static void
-change_state_logwindow (GSimpleAction *simple,
- GVariant *state,
- gpointer user_data)
-{
- g_simple_action_set_state (simple, state);
-}
-
static GActionEntry gnc_plugin_actions [] =
{
{ "OnlineActionsAction", NULL, NULL, NULL, NULL },
@@ -101,7 +93,7 @@ static GActionEntry gnc_plugin_actions [] =
{ "ABIssueIntTransAction", gnc_plugin_ab_cmd_issue_inttransaction, NULL, NULL, NULL },
{ "ABIssueSepaDirectDebitAction", gnc_plugin_ab_cmd_issue_sepa_direct_debit, NULL, NULL, NULL },
{ "AQBankingImportAction", gnc_plugin_ab_cmd_aqb_import, NULL, NULL, NULL },
- { MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW, gnc_plugin_ab_cmd_view_logwindow, NULL, "true", change_state_logwindow },
+ { MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW, gnc_plugin_ab_cmd_view_logwindow, NULL, "true", NULL },
};
/** The number of actions provided by this plugin. */
static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
commit 81fba56bbb5266cc58417236418175ddb257cebd
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon May 15 19:36:30 2023 +0100
Initialise guids in test-engine-kvp-properties.c
Valgrind: Conditional jump or move depends on uninitialised value(s)
diff --git a/libgnucash/engine/test/test-engine-kvp-properties.c b/libgnucash/engine/test/test-engine-kvp-properties.c
index 7a11dfd050..6491f36e79 100644
--- a/libgnucash/engine/test/test-engine-kvp-properties.c
+++ b/libgnucash/engine/test/test-engine-kvp-properties.c
@@ -142,7 +142,7 @@ test_account_kvp_properties (Fixture *fixture, gconstpointer pData)
gchar *ab_acct_id = "1234-5678-9087";
gchar *ab_bank_code = "0032340";
gchar *online_id_r, *ab_acct_id_r, *ab_bank_code_r;
- GncGUID *ofx_income_acct = guid_malloc ();
+ GncGUID *ofx_income_acct = guid_new ();
GncGUID *ofx_income_acct_r;
Time64 trans_retr = {gnc_time(NULL)};
Time64 *trans_retr_r;
@@ -186,8 +186,8 @@ test_account_kvp_properties (Fixture *fixture, gconstpointer pData)
static void
test_trans_kvp_properties (Fixture *fixture, gconstpointer pData)
{
- GncGUID *invoice = guid_malloc ();
- GncGUID *from_sx = guid_malloc ();
+ GncGUID *invoice = guid_new ();
+ GncGUID *from_sx = guid_new ();
GncGUID *invoice_r, *from_sx_r;
gchar *online_id = "my online id";
gchar *online_id_r;
@@ -227,7 +227,7 @@ test_split_kvp_properties (Fixture *fixture, gconstpointer pData)
gchar *online_id = "my_online_id";
gchar *debit_formula_r, *credit_formula_r, *sx_shares_r;
gchar *online_id_r;
- GncGUID *sx_account = guid_malloc ();
+ GncGUID *sx_account = guid_new ();
GncGUID *sx_account_r;
gnc_numeric debit_numeric = gnc_numeric_create (123, 456);
gnc_numeric credit_numeric = gnc_numeric_create (789, 456);
@@ -285,11 +285,11 @@ test_split_kvp_properties (Fixture *fixture, gconstpointer pData)
static void
test_lot_kvp_properties (Fixture *fixture, gconstpointer pData)
{
- GncGUID *invoice = guid_malloc ();
+ GncGUID *invoice = guid_new ();
GncGUID *invoice_r;
gint64 owner_type = 47;
gint64 owner_type_r;
- GncGUID *owner = guid_malloc ();
+ GncGUID *owner = guid_new ();
GncGUID *owner_r;
qof_begin_edit (QOF_INSTANCE (fixture->lot));
@@ -322,8 +322,8 @@ test_customer_kvp_properties (Fixture *fixture, gconstpointer pData)
{
gchar *pdf_dir = "/foo/bar/baz";
gchar *pdf_dir_r;
- GncGUID *inv_acct = guid_malloc ();
- GncGUID *pmt_acct = guid_malloc ();
+ GncGUID *inv_acct = guid_new ();
+ GncGUID *pmt_acct = guid_new ();
GncGUID *inv_acct_r, *pmt_acct_r;
qof_begin_edit (QOF_INSTANCE (fixture->cust));
@@ -358,8 +358,8 @@ test_employee_kvp_properties (Fixture *fixture, gconstpointer pData)
{
gchar *pdf_dir = "/foo/bar/baz";
gchar *pdf_dir_r;
- GncGUID *inv_acct = guid_malloc ();
- GncGUID *pmt_acct = guid_malloc ();
+ GncGUID *inv_acct = guid_new ();
+ GncGUID *pmt_acct = guid_new ();
GncGUID *inv_acct_r, *pmt_acct_r;
qof_begin_edit (QOF_INSTANCE (fixture->emp));
@@ -417,8 +417,8 @@ test_vendor_kvp_properties (Fixture *fixture, gconstpointer pData)
{
gchar *pdf_dir = "/foo/bar/baz";
gchar *pdf_dir_r;
- GncGUID *inv_acct = guid_malloc ();
- GncGUID *pmt_acct = guid_malloc ();
+ GncGUID *inv_acct = guid_new ();
+ GncGUID *pmt_acct = guid_new ();
GncGUID *inv_acct_r, *pmt_acct_r;
qof_begin_edit (QOF_INSTANCE (fixture->vend));
commit bed43c7f3b8a2dce20aa241800b26f3ae65f0b8d
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon May 15 19:12:33 2023 +0100
Fix potential crash in test-engine
==515314== Invalid read of size 1
==515314== at 0x484AD67: __strcmp_sse42 (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x171D36: do_test_list_handler (unittest-support.c:181)
==515314== by 0x171DCE: test_list_handler (unittest-support.c:197)
==515314== by 0x51BD4C1: g_logv (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51BD7A2: g_log (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4D5D0D9: xaccSplitEqualCheckBal (Split.c:753)
==515314== by 0x4D5D841: xaccSplitEqual (Split.c:869)
==515314== by 0x4D647A5: xaccTransEqual (Transaction.c:981)
==515314== by 0x15C0E8: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:901)
...
==515314== Address 0x8725260 is 0 bytes inside a block of size 59 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x15BDB1: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:883)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x5618677: __vasprintf_internal (vasprintf.c:116)
==515314== by 0x520E8C1: g_vasprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBBE0: g_strdup_vprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBC9C: g_strdup_printf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x15BBAC: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:879)
...
ok 78 /engine/Transaction/xaccTransEqual
diff --git a/libgnucash/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp
index 0a0f676ae9..3c86a780b4 100644
--- a/libgnucash/engine/test/utest-Transaction.cpp
+++ b/libgnucash/engine/test/utest-Transaction.cpp
@@ -881,6 +881,7 @@ test_xaccTransEqual (Fixture *fixture, gconstpointer pData)
frame->set({"qux", "quux", "corge"}, new KvpValue(123.456));
xaccTransCommitEdit (clone);
g_free (cleanup->msg);
+ cleanup->msg = NULL;
g_free (check->msg);
check->msg = g_strdup ("[xaccSplitEqual] GUIDs differ");
auto split1 = xaccTransGetSplit (clone, 0);
commit dc62959553f59a0a88dcc803eeac6d0eb6a2b77b
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon May 15 18:58:10 2023 +0100
Fix crash in test-engine on Arch
Thanks, Valgrind:
==515314== Invalid read of size 8
==515314== at 0x4ED46F3: gncInvoiceRemoveEntries (gncInvoice.c:767)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Address 0x8557b98 is 8 bytes inside a block of size 24 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51B565D: g_list_remove (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED42EF: gncInvoiceRemoveEntry (gncInvoice.c:688)
==515314== by 0x4ED46A2: gncInvoiceRemoveEntries (gncInvoice.c:781)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51BD948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51B1CB9: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED4271: gncInvoiceAddEntry (gncInvoice.c:676)
==515314== by 0x142401: setup_with_invoice (utest-Invoice.c:142)
...
ok 57 /engine/gncInvoice/post trans - vendor bill
diff --git a/libgnucash/engine/gncInvoice.c b/libgnucash/engine/gncInvoice.c
index f4ad3cb66b..fc5220795d 100644
--- a/libgnucash/engine/gncInvoice.c
+++ b/libgnucash/engine/gncInvoice.c
@@ -760,12 +760,13 @@ void gncInvoiceSortEntries (GncInvoice *invoice)
void gncInvoiceRemoveEntries (GncInvoice *invoice)
{
- GList *node;
-
if (!invoice) return;
- for (node = invoice->entries; node; node = node->next)
+ // gnc{Bill,Invoice}RemoveEntry free the "entry" node.
+ // Make sure to save "next" first.
+ for (GList *next, *node = invoice->entries; node; node = next)
{
+ next = node->next;
GncEntry *entry = node->data;
switch (gncInvoiceGetOwnerType (invoice))
Summary of changes:
gnucash/gnome-utils/CMakeLists.txt | 2 -
gnucash/gnome-utils/gnc-date-delta.c | 431 ---------------------
gnucash/gnome-utils/gnc-date-delta.h | 94 -----
gnucash/gnome-utils/gnc-main-window.cpp | 26 +-
gnucash/gnome/gnc-plugin-page-invoice.c | 11 +-
gnucash/gnome/gnc-plugin-page-register.c | 22 +-
gnucash/gnome/gnc-split-reg.c | 53 +--
gnucash/gnome/gnc-split-reg.h | 1 -
gnucash/import-export/aqb/gnc-plugin-aqbanking.c | 10 +-
gnucash/register/register-gnome/gnucash-cursor.h | 7 -
libgnucash/engine/gncInvoice.c | 7 +-
.../engine/test/test-engine-kvp-properties.c | 24 +-
libgnucash/engine/test/utest-Transaction.cpp | 1 +
po/POTFILES.in | 1 -
14 files changed, 33 insertions(+), 657 deletions(-)
delete mode 100644 gnucash/gnome-utils/gnc-date-delta.c
delete mode 100644 gnucash/gnome-utils/gnc-date-delta.h
More information about the gnucash-changes
mailing list