Hand-apply 9c251ca3debbf1e529b77ea4d174994ef8b5dd0b from master:
authorCarl Hetherington <cth@carlh.net>
Thu, 13 Nov 2014 11:05:39 +0000 (11:05 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 13 Nov 2014 11:05:39 +0000 (11:05 +0000)
Try to write Windows backtraces to the last-loaded-film's directory.

src/lib/film.cc
src/lib/util.cc
src/lib/util.h

index 26810992175d8da91065dfc4052d7da424afa0a2..8144759b662da603eed2b1e6f7bef91b24a8324e 100644 (file)
@@ -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;
 }
index 728e7d048199f08652329b078e214039e244bbc1..2b7df86bfbf8fd5e64a6533004b22c2d4a8b22b0 100644 (file)
@@ -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
index 93d0587c5a3200dcb45b270743311c5b9f3b6778..c06f51ca3a37ff68fdab6b7c0d7b89c298582f26 100644 (file)
@@ -82,6 +82,7 @@ extern std::string get_optional_string (std::multimap<std::string, std::string>
 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