From 09c22ea2ff3ff40b9b298475d47809b4bd373216 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 27 Jun 2016 11:23:36 +0200
Subject: 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

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()) << "_";
 
-- 
cgit v0.10.2-6-g49f6