From c151774911b4ea658410cc6593dd40390862a168 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 16 Mar 2020 17:19:24 +0300 Subject: DbgHelp: start fixing the API --- src/dbghelp.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index efbdede..cb71282 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -91,6 +91,20 @@ DbgHelp::DbgHelp(bool invade_current_process) { initialize(id, invade_current_process); } +void DbgHelp::swap(DbgHelp& other) noexcept { + using std::swap; + swap(id, other.id); +} + +DbgHelp::DbgHelp(DbgHelp&& other) noexcept { + swap(other); +} + +DbgHelp& DbgHelp::operator=(DbgHelp other) noexcept { + swap(other); + return *this; +} + DbgHelp::~DbgHelp() { try { close(); @@ -99,10 +113,7 @@ DbgHelp::~DbgHelp() { } void DbgHelp::close() { - if (!closed) { - clean_up(id); - closed = true; - } + clean_up(id); } ModuleInfo DbgHelp::load_pdb(const std::string& path) const { -- cgit v1.2.3