diff options
Diffstat (limited to '')
-rw-r--r-- | include/pdb/dbghelp.hpp | 2 | ||||
-rw-r--r-- | src/dbghelp.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/pdb/dbghelp.hpp b/include/pdb/dbghelp.hpp index 328df2d..0026bfb 100644 --- a/include/pdb/dbghelp.hpp +++ b/include/pdb/dbghelp.hpp @@ -51,7 +51,7 @@ private: void close(); - HANDLE id = GetCurrentProcess(); + HANDLE id = NULL; DbgHelp(const DbgHelp&) = delete; }; diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 8f0f7d6..4b8df7a 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -88,7 +88,7 @@ void enum_symbols(HANDLE id, } // namespace -DbgHelp::DbgHelp(bool invade_current_process) { +DbgHelp::DbgHelp(bool invade_current_process) : id{GetCurrentProcess()} { initialize(id, invade_current_process); } @@ -114,7 +114,8 @@ DbgHelp::~DbgHelp() { } void DbgHelp::close() { - clean_up(id); + if (id != NULL) + clean_up(id); } ModuleInfo DbgHelp::load_pdb(const std::string& path) const { |