From beb7c9406f6c9d3979f527db3248eab66347c846 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 17 May 2013 13:37:18 +0100 Subject: Try to integrate; add line numbers to traces. --- src/lib/util.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/lib/util.cc') diff --git a/src/lib/util.cc b/src/lib/util.cc index be078a95f..f5bcdf12c 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,9 @@ extern "C" { #include "filter.h" #include "sound_processor.h" #include "config.h" +#ifdef DVDOMATIC_WINDOWS +#include "stack.hpp" +#endif #include "i18n.h" @@ -75,12 +79,14 @@ using std::min; using std::max; using std::multimap; using std::pair; +using std::ofstream; using boost::shared_ptr; using boost::lexical_cast; using boost::optional; using libdcp::Size; boost::thread::id ui_thread; +boost::filesystem::path backtrace_file; /** Convert some number of seconds to a string representation * in hours, minutes and seconds. @@ -242,12 +248,28 @@ seconds (struct timeval t) return t.tv_sec + (double (t.tv_usec) / 1e6); } +#ifdef DVDOMATIC_WINDOWS +LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *) +{ + dbg::stack s; + ofstream f (backtrace_file.string().c_str()); + std::copy(s.begin(), s.end(), std::ostream_iterator(f, "\n")); + return EXCEPTION_CONTINUE_SEARCH; +} +#endif + /** Call the required functions to set up DVD-o-matic's static arrays, etc. * Must be called from the UI thread, if there is one. */ void dvdomatic_setup () { +#ifdef DVDOMATIC_WINDOWS + backtrace_file /= g_get_user_config_dir (); + backtrace_file /= "backtrace.txt"; + SetUnhandledExceptionFilter(exception_handler); +#endif + avfilter_register_all (); Format::setup_formats (); -- cgit v1.2.3 From 8876defcb2786b4211c9857508c042902a677c4b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 19 May 2013 00:00:45 +0100 Subject: Use C rather than POSIX for a simple known i18n for the LocaleGuard. This seems to work on both Linux and Windows. --- src/lib/util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/util.cc') diff --git a/src/lib/util.cc b/src/lib/util.cc index f5bcdf12c..2f8be6edd 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1076,8 +1076,8 @@ LocaleGuard::LocaleGuard () if (old) { _old = strdup (old); - if (strcmp (_old, "POSIX")) { - setlocale (LC_NUMERIC, "POSIX"); + if (strcmp (_old, "C")) { + setlocale (LC_NUMERIC, "C"); } } } -- cgit v1.2.3