diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-03-27 18:52:22 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-01 03:05:31 +0300 |
commit | f7e260a471010e2d656fbc5ea8c310f6d94c26b9 (patch) | |
tree | 83d89d077fd4345daafa491e7bf8ad4420e2245f /src/qt/guiutil.cpp | |
parent | 64a8755af396f1c2791018510e22b58114e68594 (diff) | |
download | bitcoin-f7e260a471010e2d656fbc5ea8c310f6d94c26b9.tar.xz |
qt: Add GUIUtil::ExceptionSafeConnect function
Throwing an exception from a slot invoked by Qt's signal-slot connection
mechanism is considered undefined behavior, unless it is handled within
the slot. The GUIUtil::ExceptionSafeConnect function should be used for
exception handling within slots.
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r-- | src/qt/guiutil.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 36fcc4d361..0e91f9f385 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -902,4 +902,15 @@ QString MakeHtmlLink(const QString& source, const QString& link) QLatin1String("<a href=\"") % link % QLatin1String("\">") % link % QLatin1String("</a>")); } +void PrintSlotException( + const std::exception* exception, + const QObject* sender, + const QObject* receiver) +{ + std::string description = sender->metaObject()->className(); + description += "->"; + description += receiver->metaObject()->className(); + PrintExceptionContinue(exception, description.c_str()); +} + } // namespace GUIUtil |