gnucash maint: Work around libstdc++ weirdness with codecvt destructor.

John Ralls jralls at code.gnucash.org
Sun Apr 22 19:51:09 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/14c30344 (commit)
	from  https://github.com/Gnucash/gnucash/commit/8e9b1346 (commit)



commit 14c30344c23d7498f9d082803f844b4ceff87c80
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Apr 22 16:51:01 2018 -0700

    Work around libstdc++ weirdness with codecvt destructor.

diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp
index 6fc3a08..b144f06 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.cpp
+++ b/libgnucash/core-utils/gnc-filepath-utils.cpp
@@ -74,7 +74,13 @@ extern "C" {
 using codecvt = std::codecvt_utf8<wchar_t, 0x10FFFF, std::little_endian>;
 using string = std::wstring;
 #else
-using codecvt = std::codecvt;
+/* See https://stackoverflow.com/questions/41744559/is-this-a-bug-of-gcc */
+template<class I, class E, class S>
+struct codecvt_r : std::codecvt<I, E, S>
+{
+    ~codecvt_r() {}
+};
+using codecvt = codecvt_r<wchar_t, char, std::mbstate_t>;
 using string = std::string;
 #endif
 static codecvt cvt;
@@ -495,10 +501,11 @@ get_user_data_dir()
     NSFileManager*fm = [NSFileManager defaultManager];
     NSArray* appSupportDir = [fm URLsForDirectory:NSApplicationSupportDirectory
     inDomains:NSUserDomainMask];
+    NSString *dirPath = nullptr;
     if ([appSupportDir count] > 0)
     {
         NSURL* dirUrl = [appSupportDir objectAtIndex:0];
-        NSString* dirPath = [dirUrl path];
+        dirPath = [dirUrl path];
     }
     return [dirPath UTF8String];
 }



Summary of changes:
 libgnucash/core-utils/gnc-filepath-utils.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list