After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789298 - Prompt for file history update leads to crash during startup
Prompt for file history update leads to crash during startup
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Engine
git-master
Other Linux
: Normal normal
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-21 15:33 UTC by Carsten Rinke
Modified: 2018-06-30 00:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Gdb log (32.96 KB, text/plain)
2017-10-22 13:41 UTC, Bob
  Details
Fix the three problems Bob Fewell found. (2.57 KB, patch)
2017-10-26 22:36 UTC, John Ralls
committed Details | Review

Description Carsten Rinke 2017-10-21 15:33:42 UTC
How to reproduce:

Open GnuCash 2.7 and open a data file.
Close the GnuCas 2.7 without closing the data file before.
(i.e. at next startup the data file will be opened automatically)

Rename or remove the last open data file and restart GnuCash 2.7

GnuCash 2.7 will notice that the data file cannot be opened anymore and displays a dialog asking if this file should be removed from the file history (yes/no).

No - GnuCash 2.7 opens normal with a blanc window (no data file opened automatically)
Yes - GnuCash 2.7 crashes. Starting again directly afterwards leads to correct behaviour: the application starts up and the renamed/removed data file is not shown in the history anymore, and the data file on top of the remaining history stack is opened automatically

The core dump message says:
gnucash crashed with SIGSEGV in qof_book_is_readonly()

Seen on Ubuntu 16.04 LTS
Comment 1 Bob 2017-10-22 09:08:17 UTC
Carsten,

I have tried to reproduce on my Gentoo Linux VM and also a native Window10 setup but on every test it worked as expected.

Say No, opens to blank window with default entry there
Say Yes, opens to blank window with default entry missing

I am using a local uncompressed xml file, is that what you are using ?
Is this a new one created by 2.7 or an old one, if old can you try solely with a new 2.7 one ?

Any more information would be appreciated to isolate, I am unable to test on a Mac as I do not have access to one.

Bob
Comment 2 Carsten Rinke 2017-10-22 11:49:41 UTC
hi Bob,

you are right, looks like there is a specific scenario needed to reproduce the issue - at least on my end.

It seems to have to do with the tax related information. If I do not apply tax information it works fine and the issue seems to be not reproducible.

Currently I can only manage to reproduce it with this sequence:

- Open GnuCash 2.7
- Goto File Menue and select New
- Cancel the Hierarchy Setup Wizard
- click the "add account" button
- create an income account (did not try other types) and press ok
- do not select the new account, directly go to Edit menue and select Tax Report Options
- Use some name
- Select Type "Individual ..."
- Select Account Type "Income" (the new account pops up below)
- Select the new account
- check the "Tax Related" button
- Press ok and exit the dialog
- Press the Save button (right below the main menue line)
- The Save As dialog comes up, enter any name and destination, press ok
- Goto to File Menue and quit GnuCash 2.7

- Open GnuCash 2.7 (works, the last used "new" book is opened)
- Press the account edit button (works, the "Tax Related" button is checked)
- Goto to File Menue and quit GnuCash 2.7

- Remove the "new" file from disk

- Open GnuCash 2.7 -> The "the file is gone - do you want to remove it from the history?" dialog comes up
- press Yes -> segmentation fault

I came to this scenario when bumping into bug 798297
Comment 3 Carsten Rinke 2017-10-22 11:56:38 UTC
correction: ... when bumping into bug 789297
Comment 4 Bob 2017-10-22 13:37:55 UTC
That's interesting, I have been looking an sqlit3 file saved from my xml test file and it fails to load. I thought it was corruption in the xml file so I used the repair option, fixed an issue but when saved it still will not load.

Ran it from gdb and it stopped with these...

  • #3 load_slot_for_book_object
    at /var/tmp/portage/app-office/gnucash-2.7.0/work/gnucash-2.7.0/libgnucash/backend/sql/gnc-slots-sql.cpp line 893
  • #4 gnc_sql_slots_load_for_sql_subquery
  • #10 GncSqlRow::get_int_at_col
    at /var/tmp/portage/app-office/gnucash-2.7.0/work/gnucash-2.7.0/libgnucash/backend/sql/gnc-sql-result.hpp line 90
  • #11 GncSqlColumnTableEntryImpl<(GncSqlObjectType)3>::load
  • #12 gnc_sql_load_object
    at /var/tmp/portage/app-office/gnucash-2.7.0/work/gnucash-2.7.0/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp line 687
  • #13 load_single_billterm
    at /var/tmp/portage/app-office/gnucash-2.7.0/work/gnucash-2.7.0/libgnucash/backend/sql/gnc-bill-term-sql.cpp line 216
  • #14 GncSqlBillTermBackend::load_all
    at /var/tmp/portage/app-office/gnucash-2.7.0/work/gnucash-2.7.0/libgnucash/backend/sql/gnc-bill-term-sql.cpp line 243

As you can see this is also to do with the TaxTable.

I will add the trace as an attachment.

Bob
Comment 5 Bob 2017-10-22 13:41:44 UTC
Created attachment 362052 [details]
Gdb log

The top of the log is to do with the commodity error, confusion but the tax problem starts at line 450

Bob
Comment 6 Arnd Hostert 2017-10-24 08:41:38 UTC
I have done a bit of testing on my MacBook Pro 5,2.
First I must say that HighSierra is not officially supported on this machine but so far all Programs that I have tested run without any Problems on the machine, including GnuCash 2.6.18.
In fact, GC2.7 also runs as you will see.

I started GC2.7 and first of all it crashed immediately on start probably because it was trying to open one of my Accounts Files.

Startup => Crash

Process:               Gnucash-bin [1931]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [1931]
User ID:               501

Date/Time:             2017-10-22 13:57:17.038 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 3700 seconds
Time Since Wake:       150 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffffb8000-00007ffffffb9000 [    4K] r-x/r-x SM=SHM  
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	0x00007fff666bceb7 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 27
1   libgncmod-engine.dylib        	0x000000011221115b KvpFrameImpl::set(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, KvpValueImpl*) + 43
2   libgncmod-engine.dylib        	0x0000000112210f8e KvpFrameImpl::set(char const*, KvpValueImpl*) + 126
3   libgnc-backend-xml-utils.dylib	0x0000000112119a6e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 238
4   libgnc-backend-xml-utils.dylib	0x00000001121198ae dom_tree_to_frame_kvp_value(_xmlNode*) + 62
5   libgnc-backend-xml-utils.dylib	0x000000011211a3b2 dom_tree_to_kvp_value(_xmlNode*) + 114
6   libgnc-backend-xml-utils.dylib	0x0000000112119a2e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 174
7   libgnc-backend-xml-utils.dylib	0x000000011211a1a8 dom_tree_generic_parse(_xmlNode*, dom_tree_handler*, void*) + 184
8   libgnc-backend-xml-utils.dylib	0x00000001120fe0d1 dom_tree_to_account(_xmlNode*, _QofBook*) + 65
9   libgnc-backend-xml-utils.dylib	0x00000001120fe193 gnc_account_end_handler(void*, _GSList*, _GSList*, void*, void*, void**, char const*) + 67
10  libgnc-backend-xml-utils.dylib	0x000000011211c6d0 sixtp_sax_end_handler(void*, unsigned char const*) + 208
11  libxml2.2.dylib               	0x00000001123ff213 xmlParseEndTag1 + 627
12  libxml2.2.dylib               	0x0000000112400443 xmlParseElement + 1875
13  libxml2.2.dylib               	0x00000001123ffb03 xmlParseContent + 355
14  libxml2.2.dylib               	0x000000011240014c xmlParseElement + 1116
15  libxml2.2.dylib               	0x00000001123ffb03 xmlParseContent + 355
16  libxml2.2.dylib               	0x000000011240014c xmlParseElement + 1116
17  libxml2.2.dylib               	0x0000000112403f12 xmlParseDocument + 1090
18  libgnc-backend-xml-utils.dylib	0x000000011211c9c2 sixtp_parse_file_common(sixtp*, _xmlParserCtxt*, void*, void*, void**) + 98
19  libgnc-backend-xml-utils.dylib	0x000000011210fe9b gnc_xml_parse_fd(sixtp*, __sFILE*, int (*)(char const*, void*, void*), void*, void*) + 43
20  libgnc-backend-xml-utils.dylib	0x0000000112113bbe qof_session_load_from_xml_file_v2_full(GncXmlBackend*, _QofBook*, void (*)(_xmlParserCtxt*, void*), void*, QofBookFileType) + 1230
21  libgnc-backend-xml-utils.dylib	0x000000011210c587 GncXmlBackend::load(_QofBook*, QofBackendLoadType) + 199
22  libgncmod-engine.dylib        	0x000000011222e2ae QofSessionImpl::load(void (*)(char const*, double)) + 270
23  libgncmod-gnome-utils.dylib   	0x0000000111f68eb8 gnc_post_file_open + 1336
24  Gnucash-bin                   	0x000000010ed687bf inner_main + 1071
25  libguile-2.0.22.dylib         	0x000000010eea89e2 invoke_main_func + 34
26  libguile-2.0.22.dylib         	0x000000010ee7f0bf c_body + 15
27  libguile-2.0.22.dylib         	0x000000010ef15186 vm_regular_engine + 8614
28  libguile-2.0.22.dylib         	0x000000010ef11da9 scm_c_vm_run + 121
29  libguile-2.0.22.dylib         	0x000000010ee872e5 scm_call_4 + 69
30  libguile-2.0.22.dylib         	0x000000010ee7f091 scm_c_with_continuation_barrier + 129
31  libguile-2.0.22.dylib         	0x000000010ef0d9f2 with_guile_and_parent + 66
32  libgc.1.dylib                 	0x000000010f05b1ab GC_call_with_stack_base + 27
33  libguile-2.0.22.dylib         	0x000000010ef0aacb scm_with_guile + 43
34  libguile-2.0.22.dylib         	0x000000010eea89a5 scm_boot_guile + 69
35  Gnucash-bin                   	0x000000010ed681e7 main + 3751
36  libdyld.dylib                 	0x00007fff68647145 start + 1


Start 2
Gnucash could not obtain Lock…. Dialog

Create New File (1st New File)

Normal Start with New Book Options Druid
Complete Druid and save File, xml Format
Restart => OK

Transaction and Scheduled Transaction tested / set up => OK

FileMenu -> Save
FileMenu -> Quit
Restart GC => OK

Actions Menu -> Scheduled Transactions -> Since Last run => OK
File Menu -> Save
Menu -> Quit
Restart => OK

File Menu -> Save as -> New Filename (2nd New File), xml format
File Menu -> Quit
Restart =>OK

File Menu -> Open -> 1st New File
Save changes to this file dialog -> Save => OK

Select 2nd new file from Recents List without specifically saving opened file via File Menu -> Save changes to the file Dialog -> Yes => OK

Insert new Tx again
File Menu -> Save
Select 1st new file from Recents List without saving the currently opened file via File Menu -> Save changes to the file Dialog -> Save => OK
File Menu -> Quit -> Save Dialog -> Save

Restart => OK
GC loads 1st new File.

Recents List -> 2nd New File -> save changes dialog-> Save => OK
Recents List -> 1st New File -> Save changes dialog-> Continue without saving =>OK
File -> Quit -> Close without Saving

Restart => OK (loads 1st new file, Checking Account Tab open)
File -> Save -> Quit => OK

RENAME 1st new file in Finder

Restart

“The File could not be found. Remove it from History” Dialog -> Yes => CRASH

Process:               Gnucash-bin [2299]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [2299]
User ID:               501

Date/Time:             2017-10-22 14:29:19.345 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 5600 seconds
Time Since Wake:       2000 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libgncmod-engine.dylib        	0x0000000110c1e735 qof_book_is_readonly + 5
1   libgnc-backend-xml-utils.dylib	0x0000000110b15315 GncXmlBackend::session_end() + 37
2   libgncmod-engine.dylib        	0x0000000110c3068b QofSessionImpl::end() + 139
3   libgncmod-engine.dylib        	0x0000000110c3055a QofSessionImpl::~QofSessionImpl() + 122
4   libgncmod-engine.dylib        	0x0000000110c307a6 qof_session_destroy + 22
5   libgncmod-gnome-utils.dylib   	0x00000001109780ff gnc_post_file_open + 1919
6   Gnucash-bin                   	0x000000010d7707bf inner_main + 1071
7   libguile-2.0.22.dylib         	0x000000010d8b59e2 invoke_main_func + 34
8   libguile-2.0.22.dylib         	0x000000010d88c0bf c_body + 15
9   libguile-2.0.22.dylib         	0x000000010d922186 vm_regular_engine + 8614
10  libguile-2.0.22.dylib         	0x000000010d91eda9 scm_c_vm_run + 121
11  libguile-2.0.22.dylib         	0x000000010d8942e5 scm_call_4 + 69
12  libguile-2.0.22.dylib         	0x000000010d88c091 scm_c_with_continuation_barrier + 129
13  libguile-2.0.22.dylib         	0x000000010d91a9f2 with_guile_and_parent + 66
14  libgc.1.dylib                 	0x000000010da681ab GC_call_with_stack_base + 27
15  libguile-2.0.22.dylib         	0x000000010d917acb scm_with_guile + 43
16  libguile-2.0.22.dylib         	0x000000010d8b59a5 scm_boot_guile + 69
17  Gnucash-bin                   	0x000000010d7701e7 main + 3751
18  libdyld.dylib                 	0x00007fff68647145 start + 1


Restart =>  OK GC Loads 2nd new File
File Menu -> Quit -> Dialog Save Changes? -> Save
Restart => OK (GC Shows 2nd new file)

File Menu -> Open -> Renamed 1st File -> Save Changes? -> Save => OK (opens 1st New File in all collapsed Account view. Checking Account Tab not open)
RecentsList -> 2nd New file -> Save changes Dialog -> Save => OK (Checking account Tab open)
RecentsList -> 1st New file -> Save? -> Save => OK (Checking Accounts Tab open)

File Menu -> Save
FileMenu ->  Open… Old Accounts File -> Save Changes Dialog -> Save => CRASH

Process:               Gnucash-bin [2373]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [2373]
User ID:               501

Date/Time:             2017-10-22 14:37:22.086 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 6100 seconds
Time Since Wake:       2500 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffffb8000-00007ffffffb9000 [    4K] r-x/r-x SM=SHM  
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	0x00007fff666bceb7 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 27
1   libgncmod-engine.dylib        	0x000000010716f15b KvpFrameImpl::set(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, KvpValueImpl*) + 43
2   libgncmod-engine.dylib        	0x000000010716ef8e KvpFrameImpl::set(char const*, KvpValueImpl*) + 126
3   libgnc-backend-xml-utils.dylib	0x0000000106e8ca6e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 238
4   libgnc-backend-xml-utils.dylib	0x0000000106e8c8ae dom_tree_to_frame_kvp_value(_xmlNode*) + 62
5   libgnc-backend-xml-utils.dylib	0x0000000106e8d3b2 dom_tree_to_kvp_value(_xmlNode*) + 114
6   libgnc-backend-xml-utils.dylib	0x0000000106e8ca2e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 174
7   libgnc-backend-xml-utils.dylib	0x0000000106e8d1a8 dom_tree_generic_parse(_xmlNode*, dom_tree_handler*, void*) + 184
8   libgnc-backend-xml-utils.dylib	0x0000000106e710d1 dom_tree_to_account(_xmlNode*, _QofBook*) + 65
9   libgnc-backend-xml-utils.dylib	0x0000000106e71193 gnc_account_end_handler(void*, _GSList*, _GSList*, void*, void*, void**, char const*) + 67
10  libgnc-backend-xml-utils.dylib	0x0000000106e8f6d0 sixtp_sax_end_handler(void*, unsigned char const*) + 208
11  libxml2.2.dylib               	0x0000000107303213 xmlParseEndTag1 + 627
12  libxml2.2.dylib               	0x0000000107304443 xmlParseElement + 1875
13  libxml2.2.dylib               	0x0000000107303b03 xmlParseContent + 355
14  libxml2.2.dylib               	0x000000010730414c xmlParseElement + 1116
15  libxml2.2.dylib               	0x0000000107303b03 xmlParseContent + 355
16  libxml2.2.dylib               	0x000000010730414c xmlParseElement + 1116
17  libxml2.2.dylib               	0x0000000107307f12 xmlParseDocument + 1090
18  libgnc-backend-xml-utils.dylib	0x0000000106e8f9c2 sixtp_parse_file_common(sixtp*, _xmlParserCtxt*, void*, void*, void**) + 98
19  libgnc-backend-xml-utils.dylib	0x0000000106e82e9b gnc_xml_parse_fd(sixtp*, __sFILE*, int (*)(char const*, void*, void*), void*, void*) + 43
20  libgnc-backend-xml-utils.dylib	0x0000000106e86bbe qof_session_load_from_xml_file_v2_full(GncXmlBackend*, _QofBook*, void (*)(_xmlParserCtxt*, void*), void*, QofBookFileType) + 1230
21  libgnc-backend-xml-utils.dylib	0x0000000106e7f587 GncXmlBackend::load(_QofBook*, QofBackendLoadType) + 199
22  libgncmod-engine.dylib        	0x000000010718c2ae QofSessionImpl::load(void (*)(char const*, double)) + 270
23  libgncmod-gnome-utils.dylib   	0x0000000106ce4eb8 gnc_post_file_open + 1336
24  libgncmod-gnome-utils.dylib   	0x0000000106cba0e9 gnc_ui_file_access_response_cb + 553
25  libgobject-2.0.0.dylib        	0x0000000104a6b391 g_cclosure_marshal_VOID__INTv + 129
26  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
27  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
28  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
29  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
30  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
31  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
32  libgtk-3.0.dylib              	0x000000010402e215 gtk_real_button_released + 181
33  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
34  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
35  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
36  libgtk-3.0.dylib              	0x000000010402e886 multipress_released_cb + 38
37  libffi.6.dylib                	0x0000000106f31884 ffi_call_unix64 + 76
38  libffi.6.dylib                	0x0000000106f30e3d ffi_call + 1005
39  libgobject-2.0.0.dylib        	0x0000000104a6a02a g_cclosure_marshal_generic_va + 1370
40  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
41  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
42  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
43  libgtk-3.0.dylib              	0x00000001040f2541 gtk_gesture_multi_press_end + 81
44  libgobject-2.0.0.dylib        	0x0000000104a6bfc8 g_cclosure_marshal_VOID__BOXEDv + 184
45  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
46  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
47  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
48  libgtk-3.0.dylib              	0x00000001040ef126 _gtk_gesture_check_recognized + 134
49  libgtk-3.0.dylib              	0x00000001040f0673 gtk_gesture_handle_event + 291
50  libgtk-3.0.dylib              	0x00000001040f3f19 gtk_gesture_single_handle_event + 505
51  libgtk-3.0.dylib              	0x00000001040be43b gtk_event_controller_handle_event + 107
52  libgtk-3.0.dylib              	0x000000010429b32c _gtk_widget_run_controllers + 124
53  libgtk-3.0.dylib              	0x0000000104140870 _gtk_marshal_BOOLEAN__BOXEDv + 192
54  libgobject-2.0.0.dylib        	0x0000000104a68c09 _g_closure_invoke_va + 297
55  libgobject-2.0.0.dylib        	0x0000000104a7e66e g_signal_emit_valist + 1582
56  libgobject-2.0.0.dylib        	0x0000000104a7f086 g_signal_emit + 134
57  libgtk-3.0.dylib              	0x000000010429afa8 gtk_widget_event_internal + 648
58  libgtk-3.0.dylib              	0x000000010413f370 propagate_event + 400
59  libgtk-3.0.dylib              	0x000000010413e8ce gtk_main_do_event + 1822
60  libgdk-3.0.dylib              	0x0000000104680251 _gdk_event_emit + 49
61  libgdk-3.0.dylib              	0x00000001046ae5d2 gdk_event_dispatch + 50
62  libglib-2.0.0.dylib           	0x0000000103e6a3e0 g_main_context_dispatch + 320
63  libglib-2.0.0.dylib           	0x0000000103e6a704 g_main_context_iterate + 420
64  libglib-2.0.0.dylib           	0x0000000103e6aa2f g_main_loop_run + 223
65  libgtk-3.0.dylib              	0x000000010413e03a gtk_main + 74
66  libgncmod-gnome-utils.dylib   	0x0000000106cea2bf gnc_ui_start_event_loop + 47
67  Gnucash-bin                   	0x0000000103af0867 inner_main + 1239
68  libguile-2.0.22.dylib         	0x0000000103c309e2 invoke_main_func + 34
69  libguile-2.0.22.dylib         	0x0000000103c070bf c_body + 15
70  libguile-2.0.22.dylib         	0x0000000103c9d186 vm_regular_engine + 8614
71  libguile-2.0.22.dylib         	0x0000000103c99da9 scm_c_vm_run + 121
72  libguile-2.0.22.dylib         	0x0000000103c0f2e5 scm_call_4 + 69
73  libguile-2.0.22.dylib         	0x0000000103c07091 scm_c_with_continuation_barrier + 129
74  libguile-2.0.22.dylib         	0x0000000103c959f2 with_guile_and_parent + 66
75  libgc.1.dylib                 	0x0000000103de41ab GC_call_with_stack_base + 27
76  libguile-2.0.22.dylib         	0x0000000103c92acb scm_with_guile + 43
77  libguile-2.0.22.dylib         	0x0000000103c309a5 scm_boot_guile + 69
78  Gnucash-bin                   	0x0000000103af01e7 main + 3751
79  libdyld.dylib                 	0x00007fff68647145 start + 1

Restart

File Menu -> Open -> Old Accounts File
(Old Accounts file .lck and .lnk Files still present)
Save Changes Dialog -> Save => Could not obtain lock Dialog -> Open Anyway => CRASH

Process:               Gnucash-bin [2461]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [2461]
User ID:               501

Date/Time:             2017-10-22 14:40:28.968 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 6300 seconds
Time Since Wake:       2700 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffffb8000-00007ffffffb9000 [    4K] r-x/r-x SM=SHM  
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	0x00007fff666bceb7 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 27
1   libgncmod-engine.dylib        	0x000000010654d15b KvpFrameImpl::set(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, KvpValueImpl*) + 43
2   libgncmod-engine.dylib        	0x000000010654cf8e KvpFrameImpl::set(char const*, KvpValueImpl*) + 126
3   libgnc-backend-xml-utils.dylib	0x0000000106454a6e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 238
4   libgnc-backend-xml-utils.dylib	0x00000001064548ae dom_tree_to_frame_kvp_value(_xmlNode*) + 62
5   libgnc-backend-xml-utils.dylib	0x00000001064553b2 dom_tree_to_kvp_value(_xmlNode*) + 114
6   libgnc-backend-xml-utils.dylib	0x0000000106454a2e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 174
7   libgnc-backend-xml-utils.dylib	0x00000001064551a8 dom_tree_generic_parse(_xmlNode*, dom_tree_handler*, void*) + 184
8   libgnc-backend-xml-utils.dylib	0x00000001064390d1 dom_tree_to_account(_xmlNode*, _QofBook*) + 65
9   libgnc-backend-xml-utils.dylib	0x0000000106439193 gnc_account_end_handler(void*, _GSList*, _GSList*, void*, void*, void**, char const*) + 67
10  libgnc-backend-xml-utils.dylib	0x00000001064576d0 sixtp_sax_end_handler(void*, unsigned char const*) + 208
11  libxml2.2.dylib               	0x0000000106742213 xmlParseEndTag1 + 627
12  libxml2.2.dylib               	0x0000000106743443 xmlParseElement + 1875
13  libxml2.2.dylib               	0x0000000106742b03 xmlParseContent + 355
14  libxml2.2.dylib               	0x000000010674314c xmlParseElement + 1116
15  libxml2.2.dylib               	0x0000000106742b03 xmlParseContent + 355
16  libxml2.2.dylib               	0x000000010674314c xmlParseElement + 1116
17  libxml2.2.dylib               	0x0000000106746f12 xmlParseDocument + 1090
18  libgnc-backend-xml-utils.dylib	0x00000001064579c2 sixtp_parse_file_common(sixtp*, _xmlParserCtxt*, void*, void*, void**) + 98
19  libgnc-backend-xml-utils.dylib	0x000000010644ae9b gnc_xml_parse_fd(sixtp*, __sFILE*, int (*)(char const*, void*, void*), void*, void*) + 43
20  libgnc-backend-xml-utils.dylib	0x000000010644ebbe qof_session_load_from_xml_file_v2_full(GncXmlBackend*, _QofBook*, void (*)(_xmlParserCtxt*, void*), void*, QofBookFileType) + 1230
21  libgnc-backend-xml-utils.dylib	0x0000000106447587 GncXmlBackend::load(_QofBook*, QofBackendLoadType) + 199
22  libgncmod-engine.dylib        	0x000000010656a2ae QofSessionImpl::load(void (*)(char const*, double)) + 270
23  libgncmod-gnome-utils.dylib   	0x00000001062a7eb8 gnc_post_file_open + 1336
24  libgncmod-gnome-utils.dylib   	0x000000010627d0e9 gnc_ui_file_access_response_cb + 553
25  libgobject-2.0.0.dylib        	0x0000000104025391 g_cclosure_marshal_VOID__INTv + 129
26  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
27  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
28  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
29  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
30  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
31  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
32  libgtk-3.0.dylib              	0x00000001035e7215 gtk_real_button_released + 181
33  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
34  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
35  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
36  libgtk-3.0.dylib              	0x00000001035e7886 multipress_released_cb + 38
37  libffi.6.dylib                	0x00000001068c0884 ffi_call_unix64 + 76
38  libffi.6.dylib                	0x00000001068bfe3d ffi_call + 1005
39  libgobject-2.0.0.dylib        	0x000000010402402a g_cclosure_marshal_generic_va + 1370
40  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
41  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
42  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
43  libgtk-3.0.dylib              	0x00000001036ab541 gtk_gesture_multi_press_end + 81
44  libgobject-2.0.0.dylib        	0x0000000104025fc8 g_cclosure_marshal_VOID__BOXEDv + 184
45  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
46  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
47  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
48  libgtk-3.0.dylib              	0x00000001036a8126 _gtk_gesture_check_recognized + 134
49  libgtk-3.0.dylib              	0x00000001036a9673 gtk_gesture_handle_event + 291
50  libgtk-3.0.dylib              	0x00000001036acf19 gtk_gesture_single_handle_event + 505
51  libgtk-3.0.dylib              	0x000000010367743b gtk_event_controller_handle_event + 107
52  libgtk-3.0.dylib              	0x000000010385432c _gtk_widget_run_controllers + 124
53  libgtk-3.0.dylib              	0x00000001036f9870 _gtk_marshal_BOOLEAN__BOXEDv + 192
54  libgobject-2.0.0.dylib        	0x0000000104022c09 _g_closure_invoke_va + 297
55  libgobject-2.0.0.dylib        	0x000000010403866e g_signal_emit_valist + 1582
56  libgobject-2.0.0.dylib        	0x0000000104039086 g_signal_emit + 134
57  libgtk-3.0.dylib              	0x0000000103853fa8 gtk_widget_event_internal + 648
58  libgtk-3.0.dylib              	0x00000001036f8370 propagate_event + 400
59  libgtk-3.0.dylib              	0x00000001036f78ce gtk_main_do_event + 1822
60  libgdk-3.0.dylib              	0x0000000103c38251 _gdk_event_emit + 49
61  libgdk-3.0.dylib              	0x0000000103c665d2 gdk_event_dispatch + 50
62  libglib-2.0.0.dylib           	0x00000001034183e0 g_main_context_dispatch + 320
63  libglib-2.0.0.dylib           	0x0000000103418704 g_main_context_iterate + 420
64  libglib-2.0.0.dylib           	0x0000000103418a2f g_main_loop_run + 223
65  libgtk-3.0.dylib              	0x00000001036f703a gtk_main + 74
66  libgncmod-gnome-utils.dylib   	0x00000001062ad2bf gnc_ui_start_event_loop + 47
67  Gnucash-bin                   	0x000000010309d867 inner_main + 1239
68  libguile-2.0.22.dylib         	0x00000001031df9e2 invoke_main_func + 34
69  libguile-2.0.22.dylib         	0x00000001031b60bf c_body + 15
70  libguile-2.0.22.dylib         	0x000000010324c186 vm_regular_engine + 8614
71  libguile-2.0.22.dylib         	0x0000000103248da9 scm_c_vm_run + 121
72  libguile-2.0.22.dylib         	0x00000001031be2e5 scm_call_4 + 69
73  libguile-2.0.22.dylib         	0x00000001031b6091 scm_c_with_continuation_barrier + 129
74  libguile-2.0.22.dylib         	0x00000001032449f2 with_guile_and_parent + 66
75  libgc.1.dylib                 	0x00000001033941ab GC_call_with_stack_base + 27
76  libguile-2.0.22.dylib         	0x0000000103241acb scm_with_guile + 43
77  libguile-2.0.22.dylib         	0x00000001031df9a5 scm_boot_guile + 69
78  Gnucash-bin                   	0x000000010309d1e7 main + 3751
79  libdyld.dylib                 	0x00007fff68647145 start + 1


Restart => OK (1st New File)
File Menu -> Open….Old Accounts File -> Save Changes Dialog -> Save => Could not obtain lock (Empty *Unsaved Book - GnuCash Window in Background) -> Open Read Only => CRASH

Process:               Gnucash-bin [2518]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [2518]
User ID:               501

Date/Time:             2017-10-22 14:44:01.748 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 6500 seconds
Time Since Wake:       2900 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffffb8000-00007ffffffb9000 [    4K] r-x/r-x SM=SHM  
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	0x00007fff666bceb7 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 27
1   libgncmod-engine.dylib        	0x000000010973915b KvpFrameImpl::set(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, KvpValueImpl*) + 43
2   libgncmod-engine.dylib        	0x0000000109738f8e KvpFrameImpl::set(char const*, KvpValueImpl*) + 126
3   libgnc-backend-xml-utils.dylib	0x0000000109642a6e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 238
4   libgnc-backend-xml-utils.dylib	0x00000001096428ae dom_tree_to_frame_kvp_value(_xmlNode*) + 62
5   libgnc-backend-xml-utils.dylib	0x00000001096433b2 dom_tree_to_kvp_value(_xmlNode*) + 114
6   libgnc-backend-xml-utils.dylib	0x0000000109642a2e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 174
7   libgnc-backend-xml-utils.dylib	0x00000001096431a8 dom_tree_generic_parse(_xmlNode*, dom_tree_handler*, void*) + 184
8   libgnc-backend-xml-utils.dylib	0x00000001096270d1 dom_tree_to_account(_xmlNode*, _QofBook*) + 65
9   libgnc-backend-xml-utils.dylib	0x0000000109627193 gnc_account_end_handler(void*, _GSList*, _GSList*, void*, void*, void**, char const*) + 67
10  libgnc-backend-xml-utils.dylib	0x00000001096456d0 sixtp_sax_end_handler(void*, unsigned char const*) + 208
11  libxml2.2.dylib               	0x0000000109924213 xmlParseEndTag1 + 627
12  libxml2.2.dylib               	0x0000000109925443 xmlParseElement + 1875
13  libxml2.2.dylib               	0x0000000109924b03 xmlParseContent + 355
14  libxml2.2.dylib               	0x000000010992514c xmlParseElement + 1116
15  libxml2.2.dylib               	0x0000000109924b03 xmlParseContent + 355
16  libxml2.2.dylib               	0x000000010992514c xmlParseElement + 1116
17  libxml2.2.dylib               	0x0000000109928f12 xmlParseDocument + 1090
18  libgnc-backend-xml-utils.dylib	0x00000001096459c2 sixtp_parse_file_common(sixtp*, _xmlParserCtxt*, void*, void*, void**) + 98
19  libgnc-backend-xml-utils.dylib	0x0000000109638e9b gnc_xml_parse_fd(sixtp*, __sFILE*, int (*)(char const*, void*, void*), void*, void*) + 43
20  libgnc-backend-xml-utils.dylib	0x000000010963cbbe qof_session_load_from_xml_file_v2_full(GncXmlBackend*, _QofBook*, void (*)(_xmlParserCtxt*, void*), void*, QofBookFileType) + 1230
21  libgnc-backend-xml-utils.dylib	0x0000000109635587 GncXmlBackend::load(_QofBook*, QofBackendLoadType) + 199
22  libgncmod-engine.dylib        	0x00000001097562ae QofSessionImpl::load(void (*)(char const*, double)) + 270
23  libgncmod-gnome-utils.dylib   	0x0000000109497eb8 gnc_post_file_open + 1336
24  libgncmod-gnome-utils.dylib   	0x000000010946d0e9 gnc_ui_file_access_response_cb + 553
25  libgobject-2.0.0.dylib        	0x000000010720f391 g_cclosure_marshal_VOID__INTv + 129
26  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
27  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
28  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
29  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
30  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
31  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
32  libgtk-3.0.dylib              	0x00000001067cc215 gtk_real_button_released + 181
33  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
34  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
35  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
36  libgtk-3.0.dylib              	0x00000001067cc886 multipress_released_cb + 38
37  libffi.6.dylib                	0x0000000109aa3884 ffi_call_unix64 + 76
38  libffi.6.dylib                	0x0000000109aa2e3d ffi_call + 1005
39  libgobject-2.0.0.dylib        	0x000000010720e02a g_cclosure_marshal_generic_va + 1370
40  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
41  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
42  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
43  libgtk-3.0.dylib              	0x0000000106890541 gtk_gesture_multi_press_end + 81
44  libgobject-2.0.0.dylib        	0x000000010720ffc8 g_cclosure_marshal_VOID__BOXEDv + 184
45  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
46  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
47  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
48  libgtk-3.0.dylib              	0x000000010688d126 _gtk_gesture_check_recognized + 134
49  libgtk-3.0.dylib              	0x000000010688e673 gtk_gesture_handle_event + 291
50  libgtk-3.0.dylib              	0x0000000106891f19 gtk_gesture_single_handle_event + 505
51  libgtk-3.0.dylib              	0x000000010685c43b gtk_event_controller_handle_event + 107
52  libgtk-3.0.dylib              	0x0000000106a3932c _gtk_widget_run_controllers + 124
53  libgtk-3.0.dylib              	0x00000001068de870 _gtk_marshal_BOOLEAN__BOXEDv + 192
54  libgobject-2.0.0.dylib        	0x000000010720cc09 _g_closure_invoke_va + 297
55  libgobject-2.0.0.dylib        	0x000000010722266e g_signal_emit_valist + 1582
56  libgobject-2.0.0.dylib        	0x0000000107223086 g_signal_emit + 134
57  libgtk-3.0.dylib              	0x0000000106a38fa8 gtk_widget_event_internal + 648
58  libgtk-3.0.dylib              	0x00000001068dd370 propagate_event + 400
59  libgtk-3.0.dylib              	0x00000001068dc8ce gtk_main_do_event + 1822
60  libgdk-3.0.dylib              	0x0000000106e1e251 _gdk_event_emit + 49
61  libgdk-3.0.dylib              	0x0000000106e4c5d2 gdk_event_dispatch + 50
62  libglib-2.0.0.dylib           	0x00000001066023e0 g_main_context_dispatch + 320
63  libglib-2.0.0.dylib           	0x0000000106602704 g_main_context_iterate + 420
64  libglib-2.0.0.dylib           	0x0000000106602a2f g_main_loop_run + 223
65  libgtk-3.0.dylib              	0x00000001068dc03a gtk_main + 74
66  libgncmod-gnome-utils.dylib   	0x000000010949d2bf gnc_ui_start_event_loop + 47
67  Gnucash-bin                   	0x0000000106283867 inner_main + 1239
68  libguile-2.0.22.dylib         	0x00000001063c09e2 invoke_main_func + 34
69  libguile-2.0.22.dylib         	0x00000001063970bf c_body + 15
70  libguile-2.0.22.dylib         	0x000000010642d186 vm_regular_engine + 8614
71  libguile-2.0.22.dylib         	0x0000000106429da9 scm_c_vm_run + 121
72  libguile-2.0.22.dylib         	0x000000010639f2e5 scm_call_4 + 69
73  libguile-2.0.22.dylib         	0x0000000106397091 scm_c_with_continuation_barrier + 129
74  libguile-2.0.22.dylib         	0x00000001064259f2 with_guile_and_parent + 66
75  libgc.1.dylib                 	0x00000001065781ab GC_call_with_stack_base + 27
76  libguile-2.0.22.dylib         	0x0000000106422acb scm_with_guile + 43
77  libguile-2.0.22.dylib         	0x00000001063c09a5 scm_boot_guile + 69
78  Gnucash-bin                   	0x00000001062831e7 main + 3751
79  libdyld.dylib                 	0x00007fff68647145 start + 1


Rename Old Accounts File to 2nd new Accounts file after having backed up 2nd New File in Finder
Restart
GC Opens with 1st new file (checking Account Tab open)
RecentsList -> 2nd new file (ie the Old Accounts file with a new name) -> Save Dialog -> Save => Crash

Process:               Gnucash-bin [2590]
Path:                  /Applications/Gnucash 2.7.app/Contents/MacOS/Gnucash-bin
Identifier:            org.gnucash.Gnucash
Version:               2.7.0 (2.7.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Gnucash-bin [2590]
User ID:               501

Date/Time:             2017-10-22 14:47:28.901 +0200
OS Version:            Mac OS X 10.13 (17A405)
Report Version:        12
Anonymous UUID:        48978761-40BA-C3E9-B5FC-E5C3F2F3A48C

Sleep/Wake UUID:       1E02DB6A-057B-4456-9839-B38E1B3D38DB

Time Awake Since Boot: 6700 seconds
Time Since Wake:       3100 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffffb8000-00007ffffffb9000 [    4K] r-x/r-x SM=SHM  
    

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	0x00007fff666bceb7 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 27
1   libgncmod-engine.dylib        	0x0000000103cab15b KvpFrameImpl::set(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, KvpValueImpl*) + 43
2   libgncmod-engine.dylib        	0x0000000103caaf8e KvpFrameImpl::set(char const*, KvpValueImpl*) + 126
3   libgnc-backend-xml-utils.dylib	0x0000000103bb6a6e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 238
4   libgnc-backend-xml-utils.dylib	0x0000000103bb68ae dom_tree_to_frame_kvp_value(_xmlNode*) + 62
5   libgnc-backend-xml-utils.dylib	0x0000000103bb73b2 dom_tree_to_kvp_value(_xmlNode*) + 114
6   libgnc-backend-xml-utils.dylib	0x0000000103bb6a2e dom_tree_to_kvp_frame_given(_xmlNode*, KvpFrameImpl*) + 174
7   libgnc-backend-xml-utils.dylib	0x0000000103bb71a8 dom_tree_generic_parse(_xmlNode*, dom_tree_handler*, void*) + 184
8   libgnc-backend-xml-utils.dylib	0x0000000103b9b0d1 dom_tree_to_account(_xmlNode*, _QofBook*) + 65
9   libgnc-backend-xml-utils.dylib	0x0000000103b9b193 gnc_account_end_handler(void*, _GSList*, _GSList*, void*, void*, void**, char const*) + 67
10  libgnc-backend-xml-utils.dylib	0x0000000103bb96d0 sixtp_sax_end_handler(void*, unsigned char const*) + 208
11  libxml2.2.dylib               	0x0000000103e98213 xmlParseEndTag1 + 627
12  libxml2.2.dylib               	0x0000000103e99443 xmlParseElement + 1875
13  libxml2.2.dylib               	0x0000000103e98b03 xmlParseContent + 355
14  libxml2.2.dylib               	0x0000000103e9914c xmlParseElement + 1116
15  libxml2.2.dylib               	0x0000000103e98b03 xmlParseContent + 355
16  libxml2.2.dylib               	0x0000000103e9914c xmlParseElement + 1116
17  libxml2.2.dylib               	0x0000000103e9cf12 xmlParseDocument + 1090
18  libgnc-backend-xml-utils.dylib	0x0000000103bb99c2 sixtp_parse_file_common(sixtp*, _xmlParserCtxt*, void*, void*, void**) + 98
19  libgnc-backend-xml-utils.dylib	0x0000000103bace9b gnc_xml_parse_fd(sixtp*, __sFILE*, int (*)(char const*, void*, void*), void*, void*) + 43
20  libgnc-backend-xml-utils.dylib	0x0000000103bb0bbe qof_session_load_from_xml_file_v2_full(GncXmlBackend*, _QofBook*, void (*)(_xmlParserCtxt*, void*), void*, QofBookFileType) + 1230
21  libgnc-backend-xml-utils.dylib	0x0000000103ba9587 GncXmlBackend::load(_QofBook*, QofBackendLoadType) + 199
22  libgncmod-engine.dylib        	0x0000000103cc82ae QofSessionImpl::load(void (*)(char const*, double)) + 270
23  libgncmod-gnome-utils.dylib   	0x0000000103a13eb8 gnc_post_file_open + 1336
24  libgncmod-gnome-utils.dylib   	0x0000000103a26c5f gnc_plugin_file_history_cmd_open_file + 127
25  libgobject-2.0.0.dylib        	0x00000001017889a1 g_closure_invoke + 273
26  libgobject-2.0.0.dylib        	0x000000010179da99 signal_emit_unlocked_R + 1881
27  libgobject-2.0.0.dylib        	0x000000010179e94e g_signal_emit_valist + 2318
28  libgobject-2.0.0.dylib        	0x000000010179f086 g_signal_emit + 134
29  libgtk-3.0.dylib              	0x0000000100cb6ca4 _gtk_action_emit_activate + 68
30  libgobject-2.0.0.dylib        	0x0000000101788c09 _g_closure_invoke_va + 297
31  libgobject-2.0.0.dylib        	0x000000010179e66e g_signal_emit_valist + 1582
32  libgobject-2.0.0.dylib        	0x000000010179f086 g_signal_emit + 134
33  libgobject-2.0.0.dylib        	0x00000001017889a1 g_closure_invoke + 273
34  libgtkmacintegration-gtk3.2.dylib	0x00000001017d787f idle_call_activate + 79
35  libgdk-3.0.dylib              	0x0000000101387d22 gdk_threads_dispatch + 50
36  libglib-2.0.0.dylib           	0x0000000100b7b3e0 g_main_context_dispatch + 320
37  libglib-2.0.0.dylib           	0x0000000100b7b704 g_main_context_iterate + 420
38  libglib-2.0.0.dylib           	0x0000000100b7ba2f g_main_loop_run + 223
39  libgtk-3.0.dylib              	0x0000000100e5203a gtk_main + 74
40  libgncmod-gnome-utils.dylib   	0x0000000103a192bf gnc_ui_start_event_loop + 47
41  Gnucash-bin                   	0x0000000100801867 inner_main + 1239
42  libguile-2.0.22.dylib         	0x000000010093d9e2 invoke_main_func + 34
43  libguile-2.0.22.dylib         	0x00000001009140bf c_body + 15
44  libguile-2.0.22.dylib         	0x00000001009aa186 vm_regular_engine + 8614
45  libguile-2.0.22.dylib         	0x00000001009a6da9 scm_c_vm_run + 121
46  libguile-2.0.22.dylib         	0x000000010091c2e5 scm_call_4 + 69
47  libguile-2.0.22.dylib         	0x0000000100914091 scm_c_with_continuation_barrier + 129
48  libguile-2.0.22.dylib         	0x00000001009a29f2 with_guile_and_parent + 66
49  libgc.1.dylib                 	0x0000000100af61ab GC_call_with_stack_base + 27
50  libguile-2.0.22.dylib         	0x000000010099facb scm_with_guile + 43
51  libguile-2.0.22.dylib         	0x000000010093d9a5 scm_boot_guile + 69
52  Gnucash-bin                   	0x00000001008011e7 main + 3751
53  libdyld.dylib                 	0x00007fff68647145 start + 1



Restart
Opens with 1st new accounts file => OK
File Menu -> Open -> Backed up 2nd new accounts file ->  Save Changes Dialog -> Save => OK (With all accounts collapsed)
RecentsList ->1st new accounts file -> Save Changes Dialog -> Save => OK (Tabs open)
File Menu -> Quit -> Save Changes Dialog -> Save

Restart
File Menu -> Open -> 1st New File => OK
(Recents list: 1) 1st New File 2) 2nd New File)

File Menu -> Open -> 2nd new file => OK
(Recents List 1) 2nd New file 2) 1st new file)

File Menu -> Open 1st new file => OK
(Recents List: 1) 1st new file 2) 2nd new file)

Quit

In Finder: 1st new File -> Right Click - Open with… => First New file opens
(RecentsList: 1) 1st new File 2) 2nd New file)

Quit

In Finder: 2nd new file -> Right Click -> Open with… => 1st new file opens
(Recents list: 1)1st new file 2) 2nd new file)

File Menu -> Open 2nd new file => OK
(Recents List 1) 2nd new file 2) 1st new file)

Quit

In Finder: 1st new file —> Right Click -> Open with… => 2nd new file opens
(Recents List: 1) 2nd new file 2) 1st new file)

Quit

In Finder: OldFile -> Right Click -> Open with… => 2nd new file opens

Quit
Comment 7 Bob 2017-10-25 13:45:23 UTC
OK, I will split what I have found to different comments...

First the commodity issue I was seeing, this is down to the order the commodities are loaded from SQL to the in memory table, hope I can explain this.

gnc-commodity-sql.cpp has a load_all function that gathers all the commodities from the SQL table and then populates the in memory table one at a time. Part of this is to do a slot query using gnc_commodity_find_commodity_by_guid and this sub query returns one row from slots but the guid referenced has not been added to the in memory table and hence returns a NULL instance. After loading six commodities, the referenced guid is finally loaded and then returns an instance.

This can be fixed by changing line 892 of gnc-slots-sql.cpp from...
    g_return_if_fail (inst != NULL);
to    
    if (inst == NULL)
        return;
Comment 8 Bob 2017-10-25 14:05:27 UTC
The second error I think is down to line 101 of gnc-bill-term-sql.cpp, that line is...

    gnc_sql_make_table_entry<CT_INT64>("parent", 0, 0, nullptr,

but I think it should be...

    gnc_sql_make_table_entry<CT_GUID>("parent", 0, 0, nullptr,

there is also this line at 215, not sure about this but is currently...

        gnc_sql_load_object (sql_be, row, GNC_ID_TAXTABLE, &s,

do not know why it is referencing the taxtable, should it be...

        gnc_sql_load_object (sql_be, row, GNC_ID_BILLTERM, &s,

With these changes the application loads but I am getting a lot of these messages in the trace file...

* 14:58:25  WARN <gnc.backend.sql> [GncSqlColumnTableEntryImpl<Otype>::load()] Invalid owner type: 0

and

* 14:58:33  WARN <gnc.business> [gncInvoiceGetType()] No invoice types defined for owner 0

a quick look in the invoices table, the field owner_guid has values like 0x25040b0 which to me does not look like a guid, will investigate.
Comment 9 Bob 2017-10-25 14:33:03 UTC
Just to add I also see those short owner_guids in the jobs table
Comment 10 John Ralls 2017-10-26 22:36:17 UTC
Created attachment 362379 [details] [review]
Fix the three problems Bob Fewell found.

Please apply this patch and see if it resolves the problems. I'd like to release 2.7.1 this weekend, so if you can do soon that would be great.
Comment 11 Bob 2017-10-27 09:27:04 UTC
John, thanks for doing the patch, wasn't sure about the changes being correct or correct c++, not even sure they were related to the problem reported but its like pulling on a thread that keeps showing errors.

The guid problem is down to this bit of code in gnc-owner-sql.cpp starting at line 214, the lines changed are commented out. The second change I am not sure about whether the field should be empty or as you had it with NULL, is there a convention to follow ?

    if (inst == nullptr)
    {
        /* Twice, once for type, once for guid. */
        std::ostringstream buff;
        buff << type;
        vec.emplace_back (std::make_pair (type_hdr, std::string{buff.str()}));
//        vec.emplace_back (std::make_pair (type_hdr, std::string{"NULL"}));
        vec.emplace_back (std::make_pair (guid_hdr, std::string{""}));
//        vec.emplace_back (std::make_pair (guid_hdr, std::string{"NULL"}));
// note:- maint empty *_guids were showing up as null fields
        return;
    }
    std::ostringstream buf;

    buf << type;
    vec.emplace_back(std::make_pair(type_hdr, buf.str()));
    buf.str("");
    auto guid = qof_instance_get_guid(inst);
    if (guid != nullptr)
//        buf << guid;
        buf << guid_to_string(guid);
    else
        buf << "NULL";
        
    vec.emplace_back(std::make_pair(guid_hdr, buf.str()));
Comment 12 Bob 2017-10-27 09:35:13 UTC
Fixing the above gets me to a new invoice with the equivalent of a blank split showing which visually looks correct. Unfortunately this brings up more errors in the trace file...

* 10:25:47  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_OVERFLOW.
* 10:25:47  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:47  CRIT <gnc.gui> gnc_date_edit_set_time_internal: assertion 'mytm != NULL' failed
* 10:25:47  WARN <qof> [gnc_numeric_to_decimal()] Rounding required when 'never round' specified.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.
* 10:26:16  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric: GNC_ERROR_ARG.

With the addition of some print statements, I get...

dialog time is 27/10/2017
date_edit time is 27/10/2017
date_edit time is 01/10/2017
date_edit time is 27/10/2017
date_edit time is 27/10/2017
date_edit time is 01/10/2017
date_edit time is 27/10/2017
gnc_price_cell_set_value_internal name is quantity string is ''
gnc_price_cell_set_value_internal name is price string is ''
gnc_price_cell_set_value_internal name is discount string is ''
gnc_price_cell_set_value_internal name is line-value string is '0.00'
gnc_price_cell_set_value_internal name is line-tax-val string is '0.00'
add_to_query billto_guid
add_to_query billto_guid
add_to_query billto_guid
gnc_price_cell_set_value_internal name is quantity string is ''
gnc_price_cell_set_value_internal name is price string is ''
gnc_price_cell_set_value_internal name is discount string is '70,364,547,792,152.00'
gnc_price_cell_set_value_internal name is line-value string is ''
gnc_price_cell_set_value_internal name is line-tax-val string is '0.00'
date_edit time is 31/12/9999

I will try and see what is going on, maybe this should be in a new bug ?
Bob
Comment 13 John Ralls 2017-10-27 13:54:54 UTC
(In reply to Bob from comment #11)
> John, thanks for doing the patch, wasn't sure about the changes being
> correct or correct c++, not even sure they were related to the problem
> reported but its like pulling on a thread that keeps showing errors.
> 
> The guid problem is down to this bit of code in gnc-owner-sql.cpp starting
> at line 214, the lines changed are commented out. The second change I am not
> sure about whether the field should be empty or as you had it with NULL, is
> there a convention to follow ?
> 
>     if (inst == nullptr)
>     {
>         /* Twice, once for type, once for guid. */
>         std::ostringstream buff;
>         buff << type;
>         vec.emplace_back (std::make_pair (type_hdr,
> std::string{buff.str()}));
> //        vec.emplace_back (std::make_pair (type_hdr, std::string{"NULL"}));
>         vec.emplace_back (std::make_pair (guid_hdr, std::string{""}));
> //        vec.emplace_back (std::make_pair (guid_hdr, std::string{"NULL"}));
> // note:- maint empty *_guids were showing up as null fields
>         return;
>     }
>     std::ostringstream buf;
> 
>     buf << type;
>     vec.emplace_back(std::make_pair(type_hdr, buf.str()));
>     buf.str("");
>     auto guid = qof_instance_get_guid(inst);
>     if (guid != nullptr)
> //        buf << guid;
>         buf << guid_to_string(guid);
>     else
>         buf << "NULL";
>         
>     vec.emplace_back(std::make_pair(guid_hdr, buf.str()));

Sorry, I don't understand what you're trying to tell me: That setting empty GUID fields to NULL in the update query doesn't work? The commented-out lines in the "inst == nullptr" block are the ones in git. The second commented-out line, buf << guid, is also what's in git and the uncommented line after is what's in the patch.
Comment 14 John Ralls 2017-10-27 14:05:27 UTC
(In reply to Bob from comment #12)
> Fixing the above gets me to a new invoice with the equivalent of a blank
> split showing which visually looks correct. Unfortunately this brings up
> more errors in the trace file...
> 
> * 10:25:47  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_OVERFLOW.
> * 10:25:47  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:47  CRIT <gnc.gui> gnc_date_edit_set_time_internal: assertion 'mytm
> != NULL' failed
> * 10:25:47  WARN <qof> [gnc_numeric_to_decimal()] Rounding required when
> 'never round' specified.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:25:48  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> * 10:26:16  WARN <gnc.gui> [PrintAmountInternal()] Bad numeric:
> GNC_ERROR_ARG.
> 
> With the addition of some print statements, I get...
> 
> dialog time is 27/10/2017
> date_edit time is 27/10/2017
> date_edit time is 01/10/2017
> date_edit time is 27/10/2017
> date_edit time is 27/10/2017
> date_edit time is 01/10/2017
> date_edit time is 27/10/2017
> gnc_price_cell_set_value_internal name is quantity string is ''
> gnc_price_cell_set_value_internal name is price string is ''
> gnc_price_cell_set_value_internal name is discount string is ''
> gnc_price_cell_set_value_internal name is line-value string is '0.00'
> gnc_price_cell_set_value_internal name is line-tax-val string is '0.00'
> add_to_query billto_guid
> add_to_query billto_guid
> add_to_query billto_guid
> gnc_price_cell_set_value_internal name is quantity string is ''
> gnc_price_cell_set_value_internal name is price string is ''
> gnc_price_cell_set_value_internal name is discount string is
> '70,364,547,792,152.00'
> gnc_price_cell_set_value_internal name is line-value string is ''
> gnc_price_cell_set_value_internal name is line-tax-val string is '0.00'
> date_edit time is 31/12/9999
> 
> I will try and see what is going on, maybe this should be in a new bug ?
> Bob

GNC_ERROR_ARG and GNC_ERROR_OVERFLOW means that those error values (-1/0 and -2/0) were  presented to print_amount(), and either will result in sending an empty string to gnc_price_cell_set_value. The question is where are those error values coming from?
Comment 15 Bob 2017-10-27 15:20:23 UTC
(In reply to John Ralls from comment #13)
> (In reply to Bob from comment #11)
> > John, thanks for doing the patch, wasn't sure about the changes being
> > correct or correct c++, not even sure they were related to the problem
> > reported but its like pulling on a thread that keeps showing errors.
> > 
> > The guid problem is down to this bit of code in gnc-owner-sql.cpp starting
> > at line 214, the lines changed are commented out. The second change I am not
> > sure about whether the field should be empty or as you had it with NULL, is
> > there a convention to follow ?
> > 
> >     if (inst == nullptr)
> >     {
> >         /* Twice, once for type, once for guid. */
> >         std::ostringstream buff;
> >         buff << type;
> >         vec.emplace_back (std::make_pair (type_hdr,
> > std::string{buff.str()}));
> > //        vec.emplace_back (std::make_pair (type_hdr, std::string{"NULL"}));
> >         vec.emplace_back (std::make_pair (guid_hdr, std::string{""}));
> > //        vec.emplace_back (std::make_pair (guid_hdr, std::string{"NULL"}));
> > // note:- maint empty *_guids were showing up as null fields
> >         return;
> >     }

> 
> Sorry, I don't understand what you're trying to tell me: That setting empty
> GUID fields to NULL in the update query doesn't work? The commented-out
> lines in the "inst == nullptr" block are the ones in git. The second
> commented-out line, buf << guid, is also what's in git and the uncommented
> line after is what's in the patch.

I did not realise you had added the guid change to the patch, sorry. The first line change is required so there is a valid type. Looking at the maint version of an sql3 file, these empty guid were showing up as null fields. What you had originally inserted the text NULL into the guid field. As I understand it you can not have a null string so changed it to "" but whether that is correct I do not know.
Comment 16 John Ralls 2017-10-27 15:58:37 UTC
(In reply to Bob from comment #15)


> I did not realise you had added the guid change to the patch, sorry. The
> first line change is required so there is a valid type. Looking at the maint
> version of an sql3 file, these empty guid were showing up as null fields.
> What you had originally inserted the text NULL into the guid field. As I
> understand it you can not have a null string so changed it to "" but whether
> that is correct I do not know.

"NULL" is a SQL keyword meaning "this field doesn't have any data". The function is part of building a SQL update or insert query. If inst is nullptr that means that owner is also nullptr and there's no type or GUID to insert.

Here's the maint version of that segment:
        subfield_value = g_new0( GValue, 1 );
        g_value_init( subfield_value, G_TYPE_STRING );
        g_value_set_string( subfield_value, "NULL" );
        (*pList) = g_slist_append( (*pList), subfield_value );
        subfield_value = g_new0( GValue, 1 );
        g_value_init( subfield_value, G_TYPE_STRING );
        g_value_set_string( subfield_value, "NULL" );
        (*pList) = g_slist_append( (*pList), subfield_value );

That also inserts "NULL" into both the owner-type and owner-guid fields. If that's blowing up load_owner then the problem is there, not here.
Comment 17 John Ralls 2017-10-27 16:30:06 UTC
And GncSqlColumnTableEntryImpl<CT_OWNERREF>::load reads the type and guid as follows:
    try
    {
        type = static_cast<decltype(type)>(row.get_int_at_col (buf.c_str()));
        buf = std::string{m_col_name} + "_guid";
        auto val = row.get_string_at_col (buf.c_str());
        string_to_guid (val.c_str(), &guid);
        pGuid = &guid;
    }
    catch (std::invalid_argument)
    {
        return;
    }

get_string_at_col should throw if the GUID field contains NULL because dbi_result_get_string() should return nullptr... but if it doesn't then the trap won't work so there should be a second check of the return value of string_to_guid, which will return false if the string doesn't produce a valid GUID.

I've found a couple of other instances of unchecked string_to_guid calls, I'll fix them too while I'm at it.
Comment 18 Bob 2017-10-27 17:04:16 UTC
OK, I will pull unstable and have another look at the weekend.
Bob
Comment 19 John Ralls 2017-10-27 17:04:56 UTC
I've pushed both the fixes in the patch and to the unchecked string_to_guid, please see if that fixes that part.

As for the prices, does your prices table have error values in it?
Comment 20 Bob 2017-10-29 13:24:03 UTC
OK, I am going back to basics, created a new unstable sqlite3 file and added one customer which looks OK. Added one blank invoice, only selecting the customer field, visually it almost looks OK and I am still getting those errors but looking at the data in sql, those empty guids have the text NULL in them.

Looking at the insert code, the NULL values were quoted. So I changed sql-backend-cpp lines 887 to

        if (col_value.second.compare("NULL") == 0)
            sql << col_value.second;
        else
            sql << quote_string(col_value.second);

and lines 917 to 

        if (col_value.second.compare("NULL") == 0)
            sql << col_value.first << "=" << col_value.second;
        else
            sql << col_value.first << "=" <<
                quote_string(col_value.second);

this now results in those text fields being NULL, a better place to do the changes would be in "quote_string" but I was confused.

The other strange thing is now every time I start gnucash with the invoice open it INSERTS another entry and UPDATES it, something else to think about.
Comment 21 Bob 2017-10-29 13:27:26 UTC
Well it looks like that last statement happens on maint as well!!!!!
Comment 22 Geert Janssens 2018-04-28 15:55:59 UTC
Review of attachment 362379 [details] [review]:

Already committed.
Comment 23 John Ralls 2018-06-30 00:00:16 UTC
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=789298. Please continue processing the bug there and please update any external references or bookmarks.