[glom/glom-1-16] Catch exceptions from std::locale::global().



commit c9a7935d7660e3eb90134318a4ecb97215bb6121
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Aug 10 14:38:54 2010 +0200

    Catch exceptions from std::locale::global().
    
    * glom/main.cc: Put a try/catch around the call to std::locale::global(),
      because it is throwing on at least one system under apparently normal
      circumstances.
      This should fix bug #619445 (teidooricaerak) or at least give us another clue.

 ChangeLog    |    9 +++++++++
 glom/main.cc |   12 +++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e796edc..429562f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-10  Murray Cumming  <murrayc murrayc com>
+
+	Catch exceptions from std::locale::global().
+
+	* glom/main.cc: Put a try/catch around the call to std::locale::global(),
+  because it is throwing on at least one system under apparently normal
+  circumstances.
+  This should fix bug #619445 (teidooricaerak) or at least give us another clue.
+
 2010-08-07  Murray Cumming  <murrayc murrayc com>
 
 	Fix the tests.
diff --git a/glom/main.cc b/glom/main.cc
index aaae0c6..349cfe6 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -436,7 +436,17 @@ main(int argc, char* argv[])
   // We should not rely on the default locale of
   // any streams (we should always do an explicit imbue()),
   // but this is maybe a good default in case we forget.
-  std::locale::global(std::locale(""));
+  try
+  {
+    std::locale::global(std::locale(""));
+  }
+  catch(const std::runtime_error& ex)
+  {
+    //This has been known to throw an exception at least once:
+    //https://bugzilla.gnome.org/show_bug.cgi?id=619445
+    //This should tell us what the problem is:
+    std::cerr << G_STRFUNC << ": exception from std::locale::global(std::locale(\"\")): " << ex.what() << std::endl;
+  }
 
   Glom::libglom_init(); //Also initializes python.
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]