Fix double free abort in gtest-gnc-datetime.cpp

This double free happened after the introduction of a class variable (static member variable
to GndDate and the test compiling in gnc-datetime.cpp *and* at the same time linking to
gnc-qof. This apparently threw off internal memory management. Removing either of linking to
gnc-qof or compiling in the source file solved it.
Credits go to John Ralls for debugging this.
This commit is contained in:
Geert Janssens 2017-04-28 18:39:31 +02:00
parent 209f971589
commit 610f6309a3
2 changed files with 8 additions and 4 deletions

View File

@ -129,8 +129,11 @@ IF (NOT WIN32)
SET(test_gnc_datetime_SOURCES
${MODULEPATH}/gnc-datetime.cpp
${MODULEPATH}/gnc-timezone.cpp
${MODULEPATH}/gnc-date.cpp
${MODULEPATH}/qoflog.cpp
gtest-gnc-datetime.cpp
${GTEST_SRC})
GNC_ADD_TEST(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
gtest_qof_INCLUDES gtest_old_qof_LIBS)
gtest_qof_INCLUDES gtest_qof_LIBS)
ENDIF()

View File

@ -212,6 +212,8 @@ check_PROGRAMS += test-gnc-timezone
test_gnc_datetime_SOURCES = \
$(top_srcdir)/$(MODULEPATH)/gnc-datetime.cpp \
$(top_srcdir)/$(MODULEPATH)/gnc-timezone.cpp \
$(top_srcdir)/$(MODULEPATH)/gnc-date.cpp \
$(top_srcdir)/${MODULEPATH}/qoflog.cpp \
gtest-gnc-datetime.cpp
test_gnc_datetime_CPPFLAGS =\
-I$(GTEST_HEADERS) \
@ -221,10 +223,9 @@ test_gnc_datetime_CPPFLAGS =\
$(BOOST_CPPFLAGS)
test_gnc_datetime_LDADD = \
-lboost_date_time \
${top_builddir}/${MODULEPATH}/libgnc-qof.la \
$(GLIB_LIBS) \
$(GTEST_LIBS)
$(GTEST_LIBS) \
${BOOST_LDFLAGS} -lboost_regex -lboost_date_time
if !GOOGLE_TEST_LIBS
nodist_test_gnc_datetime_SOURCES = \
$(GTEST_SRC)/src/gtest_main.cc