aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/handler.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2019-09-27 07:31:44 -0400
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-10-26 14:55:30 +0100
commit81ea66c30e2953dee24d5b127c28daa0d9452a28 (patch)
tree0eb3bea23966c81ffc77a37081390b39c71d5a7c /src/interfaces/handler.cpp
parentbe50469217bd775c4305938634c32e5932f47841 (diff)
Drop signal CClientUIInterface::LoadWallet
Diffstat (limited to 'src/interfaces/handler.cpp')
-rw-r--r--src/interfaces/handler.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/interfaces/handler.cpp b/src/interfaces/handler.cpp
index 92601fc4e9..4e235688fe 100644
--- a/src/interfaces/handler.cpp
+++ b/src/interfaces/handler.cpp
@@ -22,6 +22,15 @@ public:
boost::signals2::scoped_connection m_connection;
};
+class CleanupHandler : public Handler
+{
+public:
+ explicit CleanupHandler(std::function<void()> cleanup) : m_cleanup(std::move(cleanup)) {}
+ ~CleanupHandler() override { if (!m_cleanup) return; m_cleanup(); m_cleanup = nullptr; }
+ void disconnect() override { if (!m_cleanup) return; m_cleanup(); m_cleanup = nullptr; }
+ std::function<void()> m_cleanup;
+};
+
} // namespace
std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection)
@@ -29,4 +38,9 @@ std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection)
return MakeUnique<HandlerImpl>(std::move(connection));
}
+std::unique_ptr<Handler> MakeHandler(std::function<void()> cleanup)
+{
+ return MakeUnique<CleanupHandler>(std::move(cleanup));
+}
+
} // namespace interfaces