mobile: save changes from main event loop

When autosync to cloud was enabled, the old code would crash,
because it synced to cloud from a signal handler, which executed
the main loop when checking the cloud connection, which deleted
the object which was causing the original signal. Or something
like that. See discussion in #4119.

To avoid such problems, send a signal via a 'QueuedConnection'
from QMLManager to itself. The slot will be called once the
signal handler terminates and the main event loop retakes
control.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-30 21:55:22 +01:00 committed by bstoeger
parent 2172e18298
commit de313bd01a
2 changed files with 25 additions and 3 deletions

View file

@ -9,6 +9,7 @@
#include <QElapsedTimer>
#include <QColor>
#include <QFile>
#include <QTimer>
#include "core/btdiscovery.h"
#include "core/downloadfromdcthread.h"
@ -299,6 +300,7 @@ signals:
void restartDownloadSignal();
void syncStateChanged();
void passwordStateChanged();
void changesNeedSavingSignal();
// From upload process
void uploadFinish(bool success, const QString &text);
@ -306,6 +308,7 @@ signals:
private slots:
void uploadFinishSlot(bool success, const QString &text, const QByteArray &html);
void saveUnsaved();
};
#endif