Back to QFutureWatcher, but we allocate/destroy it ourselves.
This reverts commit c64eef54f6584b26f14933f0c8e600d5ad2dacbb.
This commit is contained in:
parent
496d917d94
commit
fbb293c15a
@ -49,7 +49,8 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QFutureWatcher>
|
||||||
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
hasRootPartition( Device* device )
|
hasRootPartition( Device* device )
|
||||||
@ -531,11 +532,16 @@ PartitionCoreModule::revertDevice( Device* dev )
|
|||||||
void
|
void
|
||||||
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
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 );
|
callback();
|
||||||
QTimer::singleShot( 0, callback );
|
watcher->deleteLater();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev );
|
||||||
|
watcher->setFuture( future );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user