mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #540 Add the ability to capture the current call stack, and use it in singleShot.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include "variant.h"
|
||||
#include "stacktrace.h"
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QTimer>
|
||||
@@ -53,8 +54,10 @@ namespace BlackMisc
|
||||
auto *timer = new QTimer;
|
||||
timer->setSingleShot(true);
|
||||
timer->moveToThread(target);
|
||||
auto trace = getStackTrace();
|
||||
QObject::connect(timer, &QTimer::timeout, [ = ]()
|
||||
{
|
||||
static_cast<void>(trace);
|
||||
task();
|
||||
timer->deleteLater();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user