diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2023-07-07 17:32:54 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-12-04 15:39:15 -0400 |
commit | f4a8bd6e2f03e786a84dd7763d1c04665e6371f2 (patch) | |
tree | b43fad6b05ce002f143f77a00d2bc394857366ea /src/qt/winshutdownmonitor.h | |
parent | f0c73c1336bee74fe2d58474ac36bca28c219e85 (diff) | |
download | bitcoin-f4a8bd6e2f03e786a84dd7763d1c04665e6371f2.tar.xz |
refactor: Remove call to StartShutdown from qt
Use interfaces::Node object instead.
There is a minor change in behavior in this commit, because the new code calls
InterruptRPC() and StopRPC() when previous code did not do this. But this
should be a good thing since it makes sense to interrupt RPC when the system is
shutting down, and it is better for the GUI shut down in a consistent way
regardless of how the shutdown is triggered.
Diffstat (limited to 'src/qt/winshutdownmonitor.h')
-rw-r--r-- | src/qt/winshutdownmonitor.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qt/winshutdownmonitor.h b/src/qt/winshutdownmonitor.h index 72655da3da..78f287637f 100644 --- a/src/qt/winshutdownmonitor.h +++ b/src/qt/winshutdownmonitor.h @@ -8,6 +8,7 @@ #ifdef WIN32 #include <QByteArray> #include <QString> +#include <functional> #include <windef.h> // for HWND @@ -16,11 +17,16 @@ class WinShutdownMonitor : public QAbstractNativeEventFilter { public: + WinShutdownMonitor(std::function<void()> shutdown_fn) : m_shutdown_fn{std::move(shutdown_fn)} {} + /** Implements QAbstractNativeEventFilter interface for processing Windows messages */ bool nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult) override; /** Register the reason for blocking shutdown on Windows to allow clean client exit */ static void registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId); + +private: + std::function<void()> m_shutdown_fn; }; #endif |