Bug 740471 -  Applying payment to invoice Segmentation fault

Attempt to fix it by no longer nullifying lots during processing
Bug 740471 -  Applying payment to invoice Segmentation fault

Clear selection before emptying list store to prevent
the code from running calculations on a changing list.
Bug 740471 -  Applying payment to invoice Segmentation fault

Stop listening for gui update events while on the way out
(after the ok button was pressed).
Remove note from the top of environment.in. It's obsolete.
Fix Guile compiled path in environment.in

Compiled files go to prefix/lib/guile/2.0/ccache, which isn't the same as
where the source files are stored (prefix/share/guile/2.0), so provide a
separate variable for it. Also don't throw away the user's value of
GUILE_LOAD_COMPILED_PATH in favor of GUILE_LOAD_PATH.
Bug 739584 - gnucash-2.6.4 segfaults regularly on transfer .

Ensure that xferData is nulled after free and that client functions check
for the NULL.
Adjust #ifdef __clang__ to exclude clang versions > 6

This works only with Apple clang; the regular clang is at version 3, but
hasn't been tested for what versions emit what sort of function signatures
to logs.
Replace GNC_HOME/bin with gnc_path_get_bindir().

For consistency with the rest of the function.
Tell Guile (and others) to look in install/lib/gnucash for ligraries.
Without this Guile can't find libgncmod-engine and GnuCash won't start,
at least sometimes.
Move code to open report options dialog from guile to C

This code was switching a lot between the guile and C context.
This move at least reduces some of them. The switches can only
be eliminated completely when the options code itself gets
rewritten in C(++).
Bug 741810 - Compilation fails because of creating .gnucash
Cherry-pick "Bug 741810 - Compilation fails because of creating .gnucash"

This was meant to go on maint first...
Periodic merge of branch 'maint'

* Bug 740471 -  Applying payment to invoice Segmentation fault
* Fix Guile compiled path in environment.in
* Bug 739584 - gnucash-2.6.4 segfaults regularly on transfer
* Adjust #ifdef __clang__ to exclude clang versions > 6
* Replace GNC_HOME/bin with gnc_path_get_bindir().
* Tell Guile (and others) to look in install/lib/gnucash for ligraries.

Conflicts:
	src/bin/environment.in
	src/engine/test/utest-Account.c
	src/engine/test/utest-Split.cpp
	src/engine/test/utest-Transaction.c
	src/libqof/qof/test/test-gnc-date.c
	src/libqof/qof/test/test-qofbook.c