diff options
| author | tobtoht <tob@featherwallet.org> | 2026-01-29 15:40:40 +0000 |
|---|---|---|
| committer | tobtoht <tob@featherwallet.org> | 2026-01-29 15:40:40 +0000 |
| commit | 88c0237cada50652f1cc83130d7195a27d6aafba (patch) | |
| tree | fce076167c81074007cde59a886927f77573a854 | |
| parent | 4bb527b200c176145361f7dc233185b6f03c593c (diff) | |
| parent | 80e209df42c091fabd03c229aea5e49826c44b9b (diff) | |
| download | monzero-gui-88c0237cada50652f1cc83130d7195a27d6aafba.tar.gz monzero-gui-88c0237cada50652f1cc83130d7195a27d6aafba.tar.xz monzero-gui-88c0237cada50652f1cc83130d7195a27d6aafba.zip | |
Merge pull request #4558
80e209d filter: intercept quit event to avoid deadlock (selsta)
| -rw-r--r-- | main.qml | 10 | ||||
| -rw-r--r-- | src/main/filter.cpp | 5 | ||||
| -rw-r--r-- | src/main/filter.h | 1 | ||||
| -rw-r--r-- | src/main/main.cpp | 1 |
4 files changed, 17 insertions, 0 deletions
@@ -100,6 +100,7 @@ ApplicationWindow { property bool splashDisplayedBeforeButtonRequest; property bool themeTransition: false property int backgroundSyncType: Wallet.BackgroundSync_Off; + property bool isQuitting: false // fiat price conversion property real fiatPrice: 0 @@ -282,6 +283,15 @@ ApplicationWindow { persistentSettings.kdfRounds); } + function gracefulQuit() { + if (isQuitting) + return; + isQuitting = true; + closeWallet(function() { + Qt.quit(); + }) + } + function closeWallet(callback) { // Disconnect all listeners diff --git a/src/main/filter.cpp b/src/main/filter.cpp index 1f8155a9..a68f4cac 100644 --- a/src/main/filter.cpp +++ b/src/main/filter.cpp @@ -38,6 +38,11 @@ filter::filter(QObject *parent) : } bool filter::eventFilter(QObject *obj, QEvent *ev) { + if (ev->type() == QEvent::Quit) { + emit quitRequested(); + return true; + } + // macOS sends fileopen signal for incoming uri handlers if (ev->type() == QEvent::FileOpen) { QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(ev); diff --git a/src/main/filter.h b/src/main/filter.h index 5c5bf57a..6ed643d2 100644 --- a/src/main/filter.h +++ b/src/main/filter.h @@ -44,6 +44,7 @@ protected: bool eventFilter(QObject *obj, QEvent *ev); signals: + void quitRequested(); void sequencePressed(const QVariant &o, const QVariant &seq); void sequenceReleased(const QVariant &o, const QVariant &seq); void mousePressed(const QVariant &o, const QVariant &x, const QVariant &y); diff --git a/src/main/main.cpp b/src/main/main.cpp index 38901d3f..7ed9e61c 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -562,6 +562,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw qCritical() << "QrCodeScanner : something went wrong !"; #endif + QObject::connect(eventFilter, &filter::quitRequested, rootObject, [rootObject]{ QMetaObject::invokeMethod(rootObject, "gracefulQuit", Qt::QueuedConnection); }); QObject::connect(eventFilter, SIGNAL(sequencePressed(QVariant,QVariant)), rootObject, SLOT(sequencePressed(QVariant,QVariant))); QObject::connect(eventFilter, SIGNAL(sequenceReleased(QVariant,QVariant)), rootObject, SLOT(sequenceReleased(QVariant,QVariant))); QObject::connect(eventFilter, SIGNAL(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant))); |
