diff --git a/src/libqof/qof/qofbook.c b/src/libqof/qof/qofbook.c index 18f347a2e4..e72de76374 100644 --- a/src/libqof/qof/qofbook.c +++ b/src/libqof/qof/qofbook.c @@ -390,7 +390,7 @@ void qof_book_set_version (QofBook *book, gint32 version) } gint64 -qof_book_get_counter (const QofBook *book, const char *counter_name) +qof_book_get_counter (QofBook *book, const char *counter_name) { QofBackend *be; KvpFrame *kvp; @@ -439,9 +439,12 @@ qof_book_get_counter (const QofBook *book, const char *counter_name) counter++; /* Save off the new counter */ + qof_book_begin_edit(book); value = kvp_value_new_gint64 (counter); kvp_frame_set_slot_path (kvp, value, "counters", counter_name, NULL); kvp_value_delete (value); + qof_book_mark_dirty(book); + qof_book_commit_edit(book); /* and return the value */ return counter; diff --git a/src/libqof/qof/qofbook.h b/src/libqof/qof/qofbook.h index 9f72df0fdd..cb0c30b734 100644 --- a/src/libqof/qof/qofbook.h +++ b/src/libqof/qof/qofbook.h @@ -281,7 +281,7 @@ gboolean qof_book_equal (const QofBook *book_1, const QofBook *book_2); /** This will 'get and increment' the named counter for this book. * The return value is -1 on error or the incremented counter. */ -gint64 qof_book_get_counter (const QofBook *book, const char *counter_name); +gint64 qof_book_get_counter (QofBook *book, const char *counter_name); const char* qof_book_get_string_option(const QofBook* book, const char* opt_name); void qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val);