mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 19:35:44 -05:00
Back to QFutureWatcher, but we allocate/destroy it ourselves.
This reverts commit c64eef54f6584b26f14933f0c8e600d5ad2dacbb.
This commit is contained in:
parent
496d917d94
commit
fbb293c15a
1 changed files with 10 additions and 4 deletions
|
@ -49,7 +49,8 @@
|
|||
#include <QStandardItemModel>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QFutureWatcher>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
static bool
|
||||
hasRootPartition( Device* device )
|
||||
|
@ -531,11 +532,16 @@ PartitionCoreModule::revertDevice( Device* dev )
|
|||
void
|
||||
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
||||
{
|
||||
QTimer::singleShot( 0, this, [=]
|
||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||
connect( watcher, &QFutureWatcher< void >::finished,
|
||||
this, [ watcher, callback ]
|
||||
{
|
||||
revertDevice( dev );
|
||||
QTimer::singleShot( 0, callback );
|
||||
callback();
|
||||
watcher->deleteLater();
|
||||
} );
|
||||
|
||||
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev );
|
||||
watcher->setFuture( future );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue