From 8b4e11060b37ad70754aa665ad59744eadd2dd1e Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 22 Feb 2013 19:28:54 +0100 Subject: - bugfix: update on overwrite directory leads files incorrectly being assigned to it - bugfix: getfullpathname reroute now correctly handles relative paths - bugfix: cwd change to overwrite is now handled too - bugfix: using the external fomod installer to merge a mod caused error messages because directories couldn't be renamed - bugfix: The memory for file dialogs wasn't saved to the ini file - file category (main, update, optional, old) is now stored with the download for future use - when overwriting a mod, the version of the mod is only increased, never reduced. This is less correct for the unusual case that the user is downgrading but more correct for the more commen case he is installing an optional file with incorrect version number - the install mod dialog now uses the file dialog memory --- src/shared/directoryentry.cpp | 2 +- src/shared/directoryentry.h | 1 + src/shared/util.cpp | 36 +++++++++++++++++++++++++++++++++++- src/shared/util.h | 3 +++ 4 files changed, 40 insertions(+), 2 deletions(-) (limited to 'src/shared') diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index eaba91a6..abf9affb 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -155,7 +155,7 @@ void FilesOrigin::setPriority(int priority) { m_OriginConnection->changePriorityLookup(m_Priority, priority); - m_Priority = priority; + m_Priority = priority; } diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index e292861d..c6d155de 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see . #include #include "util.h" + namespace MOShared { diff --git a/src/shared/util.cpp b/src/shared/util.cpp index c256e959..a6378a74 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -19,8 +19,11 @@ along with Mod Organizer. If not, see . #include "util.h" #include "windows_error.h" +#include "error_report.h" + #include #include +#include namespace MOShared { @@ -119,4 +122,35 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName) } } -} // namespace MOShared + + + +std::string GetStack() +{ +#ifdef DEBUG + HANDLE process = ::GetCurrentProcess(); + static bool firstCall = true; + if (firstCall) { + ::SymInitialize(process, NULL, TRUE); + firstCall = false; + } + + LPVOID stack[32]; + WORD frames = ::CaptureStackBackTrace(0, 100, stack, NULL); + SYMBOL_INFO_PACKAGE symbol; + symbol.si.SizeOfStruct = sizeof(SYMBOL_INFO); + symbol.si.MaxNameLen = MAX_SYM_NAME; + + std::ostringstream stackStream; + for(unsigned int i = 0; i < frames; ++i) { + ::SymFromAddr(process, (DWORD64)(stack[i]), 0, &symbol.si); + stackStream << frames - i - 1 << ": " << symbol.si.Name << "\n"; + } + return stackStream.str(); +#else + return ""; +#endif +} + + +} // namespace MOShared diff --git a/src/shared/util.h b/src/shared/util.h index 4faf0a30..9c59f6db 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -45,6 +45,9 @@ std::wstring ToLower(const std::wstring &text); VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName); +/// Get a stack trace as a line-break separated list of function names. This only works in debug builds +std::string GetStack(); + } // namespace MOShared #endif // UTIL_H -- cgit v1.3.1