diff options
author | Tobias Markmann <tm@ayena.de> | 2016-06-27 09:23:36 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-06-27 09:23:36 (GMT) |
commit | 09c22ea2ff3ff40b9b298475d47809b4bd373216 (patch) | |
tree | 0261a06968b4987c320dd722c3b869ff45cb4033 | |
parent | e5d57519f573ef3718ec207c6f81006b4a0e0244 (diff) | |
download | swift-09c22ea2ff3ff40b9b298475d47809b4bd373216.zip swift-09c22ea2ff3ff40b9b298475d47809b4bd373216.tar.bz2 |
Fix cleanup of date_facet instance
The C++ standard library takes ownership of the date_facet
instance passed into the locale object ctor.
Test-Information:
Without this fix Swift would crash on exit when build with
ASAN. With this fix it does not anymore on OS X 10.11.5.
Change-Id: I46a87d9d6840408556722feeebe28a13e0d351b2
-rw-r--r-- | Swift/QtUI/main.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index 11f51f6..4850b49 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -40,9 +40,11 @@ int main(int argc, char* argv[]) { // Set crash report prefix to include date and version. std::stringstream prefix; - auto outputFacet = std::unique_ptr<boost::gregorian::date_facet>(new boost::gregorian::date_facet()); + + // This date_facet will be cleaned up by the stringstream. + auto outputFacet = new boost::gregorian::date_facet(); outputFacet->format("%Y-%m-%d"); - prefix.imbue(std::locale(std::locale::classic(), outputFacet.get())); + prefix.imbue(std::locale(std::locale::classic(), outputFacet)); prefix << buildVersion << "_" << boost::gregorian::date(boost::gregorian::day_clock::local_day()) << "_"; |