[glom] Catch exceptions from std::locale::global().



commit 5a9be9de64341b901cfeeb64766435c9a8e830e6
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 7f1b0f8..7969ff8 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-09  Murray Cumming  <murrayc murrayc com>
 
 	test_document_autosave: Change the temp filename to avoid a clash.
diff --git a/glom/main.cc b/glom/main.cc
index 81f1e44..67546be 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]