mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-01 18:17:26 -04:00
Merge pull request #4558
80e209d filter: intercept quit event to avoid deadlock (selsta)
This commit is contained in:
10
main.qml
10
main.qml
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user