From 59a87a29043d29907c389b9fca7b5865bc0bdf84 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 13 Nov 2014 11:05:39 +0000 Subject: [PATCH] Hand-apply 9c251ca3debbf1e529b77ea4d174994ef8b5dd0b from master: Try to write Windows backtraces to the last-loaded-film's directory. --- src/lib/film.cc | 3 +++ src/lib/util.cc | 11 +++++++++-- src/lib/util.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/film.cc b/src/lib/film.cc index 268109921..8144759b6 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -467,6 +467,9 @@ Film::read_metadata () /* This method is the only one that can return notes (so far) */ _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); + /* Write backtraces to this film's directory, until another film is loaded */ + set_backtrace_file (file ("backtrace.txt")); + _dirty = false; return notes; } diff --git a/src/lib/util.cc b/src/lib/util.cc index 728e7d048..2b7df86bf 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -282,6 +282,12 @@ LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *) } #endif +void +set_backtrace_file (boost::filesystem::path p) +{ + backtrace_file = p; +} + /* From http://stackoverflow.com/questions/2443135/how-do-i-find-where-an-exception-was-thrown-in-c */ void terminate () @@ -317,8 +323,9 @@ void dcpomatic_setup () { #ifdef DCPOMATIC_WINDOWS - backtrace_file /= g_get_user_config_dir (); - backtrace_file /= "backtrace.txt"; + boost::filesystem::path p = g_get_user_config_dir (); + p /= "backtrace.txt"; + set_backtrace_file (p); SetUnhandledExceptionFilter(exception_handler); /* Dark voodoo which, I think, gets boost::filesystem::path to diff --git a/src/lib/util.h b/src/lib/util.h index 93d0587c5..c06f51ca3 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -82,6 +82,7 @@ extern std::string get_optional_string (std::multimap extern void* wrapped_av_malloc (size_t); extern int64_t divide_with_round (int64_t a, int64_t b); extern ContentTimePeriod subtitle_period (AVSubtitle const &); +extern void set_backtrace_file (boost::filesystem::path); /** @class Socket * @brief A class to wrap a boost::asio::ip::tcp::socket with some things -- 2.30.2