I have encountered the following situation:
void Plugin::sendMessage(const QString& jid, const QString &message) {
qDebug() << "SENDING TO JID1: " << jid;
QtConcurrent::run([&, this]() {
qDebug() << "SENDING TO JID2: " << jid;
}
}
produces next output:
SENDING TO JID1: "test@xmpp.org"
SENDING TO JID2: "
and then it crashes. It looks like jid
is no longer exists in the lambda, but why? How then can I use the variables by references in this code?