gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Wed Mar 30 09:40:29 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/ee40d5dc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/826ebf2d (commit)
	from  https://github.com/Gnucash/gnucash/commit/ec768b16 (commit)



commit ee40d5dce7d49b73218a3e0428dea78e6b6fcd17
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Mar 30 15:09:57 2016 +0200

    Fix counter format resetting in a private kvp compatible way

diff --git a/src/app-utils/business-options.scm b/src/app-utils/business-options.scm
index 7e3c22d..639e5fb 100644
--- a/src/app-utils/business-options.scm
+++ b/src/app-utils/business-options.scm
@@ -474,11 +474,11 @@
      (gnc:set-option-scm->kvp option
          (lambda (b p)
              (let ((value ((gnc:option-getter option)))
-                   (path (list "counter_formats" key)))
-                  (if (and (string? value)(not (string-null? value)))
-                      (qof-book-set-option b value path)))))
+                   (path (string-concatenate (list "counter_formats/" key))))
+                  (qof-book-set-string-option b path value))))
      (gnc:set-option-kvp->scm option (lambda (b p)
-                               (let ((v (qof-book-get-option b (list "counter_formats" key))))
+                               (let* ((path (string-concatenate (list "counter_formats/" key)))
+                                     (v (qof-book-get-string-option b path)))
                                  (if (and v (string? v))
                                      ((gnc:option-setter option) v)))))
      option))
diff --git a/src/engine/engine.i b/src/engine/engine.i
index ee715d2..c871292 100644
--- a/src/engine/engine.i
+++ b/src/engine/engine.i
@@ -252,6 +252,9 @@ KvpValue* qof_book_get_option (QofBook *book, GSList *key_path);
 
 %clear GSList *key_path;
 
+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);
+
 #if defined(SWIGGUILE)
 %init {
   {
diff --git a/src/libqof/qof/qofbook.cpp b/src/libqof/qof/qofbook.cpp
index 98349be..2817ee9 100644
--- a/src/libqof/qof/qofbook.cpp
+++ b/src/libqof/qof/qofbook.cpp
@@ -1092,7 +1092,10 @@ qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_
 {
     qof_book_begin_edit(book);
     auto frame = qof_instance_get_slots(QOF_INSTANCE(book));
-    delete frame->set(opt_name, new KvpValue(opt_val));
+    if (opt_val && (*opt_val != '\0'))
+        delete frame->set(opt_name, new KvpValue(g_strdup(opt_val)));
+    else
+        delete frame->set(opt_name, nullptr);
     qof_instance_set_dirty (QOF_INSTANCE (book));
     qof_book_commit_edit(book);
 }

commit 826ebf2d2b3bc2d95c4b5dae0e37792924eb8c62
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Mar 30 11:09:05 2016 +0200

    Fix critical warning introduced in f5a7aeca7913
    
    Critical warning happens only on master branch

diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index 282c015..447c84d 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -491,9 +491,10 @@ gnc_payment_dialog_owner_changed (PaymentWindow *pw)
     pw->invoice = NULL;
 
     /* Now handle the account tree */
-    qof_instance_get (qofOwnerGetOwner (owner),
-		      "payment-last-account", &guid,
-		      NULL);
+    if (gncOwnerIsValid(owner))
+        qof_instance_get (qofOwnerGetOwner (owner),
+                          "payment-last-account", &guid,
+                          NULL);
 
     /* refresh the post and acc available accounts, but cleanup first */
     if (pw->acct_types)



Summary of changes:
 src/app-utils/business-options.scm           | 8 ++++----
 src/business/business-gnome/dialog-payment.c | 7 ++++---
 src/engine/engine.i                          | 3 +++
 src/libqof/qof/qofbook.cpp                   | 5 ++++-
 4 files changed, 15 insertions(+), 8 deletions(-)



More information about the gnucash-changes mailing list