gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Apr 4 19:48:07 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/bc1f5b80 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/efb24f09 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a1bec6fc (commit)



commit bc1f5b80c1457ca43fc42c6f0aa85f45549ee136
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Apr 4 16:46:00 2023 -0700

    Fix crash if gnucash-cli --quotes is passed a bad database name.
    
    cleanup_and_exit_with_failure doesn't exit anymore so we need
    to return its error value instead of trying to keep using the
    freed session.

diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp
index c603241905..acbf9fb712 100644
--- a/gnucash/gnucash-commands.cpp
+++ b/gnucash/gnucash-commands.cpp
@@ -342,11 +342,11 @@ Gnucash::add_quotes (const bo_str& uri)
 
     qof_session_begin(session, uri->c_str(), SESSION_NORMAL_OPEN);
     if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
-        cleanup_and_exit_with_failure (session);
+        return cleanup_and_exit_with_failure (session);
 
     qof_session_load(session, NULL);
     if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
-        cleanup_and_exit_with_failure (session);
+        return cleanup_and_exit_with_failure (session);
 
     try
     {
@@ -365,7 +365,7 @@ Gnucash::add_quotes (const bo_str& uri)
     }
     qof_session_save(session, NULL);
     if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
-        cleanup_and_exit_with_failure (session);
+        return cleanup_and_exit_with_failure (session);
 
     qof_session_destroy(session);
     qof_event_resume();

commit efb24f090dc96845c21fe86898f1850423b7e2db
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Apr 4 16:37:57 2023 -0700

    Bug 798815 - flatpak run --command=gnucash-cli cannot download...
    
    quotes since 5.0.
    
    The filename is getting stuffed into the m_quotes_cmd vector unless --namespace
    is specified, so check if that's happened and copy the value over.

diff --git a/gnucash/gnucash-cli.cpp b/gnucash/gnucash-cli.cpp
index 123ba504d1..23a8475fc9 100644
--- a/gnucash/gnucash-cli.cpp
+++ b/gnucash/gnucash-cli.cpp
@@ -139,6 +139,8 @@ Gnucash::GnucashCli::start ([[maybe_unused]] int argc, [[maybe_unused]] char **a
         }
         else if (m_quotes_cmd.front() == "get")
         {
+            if (!m_file_to_load && m_quotes_cmd.size() == 2)
+                m_file_to_load = m_quotes_cmd[1];
 
             if (!m_file_to_load || m_file_to_load->empty())
             {



Summary of changes:
 gnucash/gnucash-cli.cpp      | 2 ++
 gnucash/gnucash-commands.cpp | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list