diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-04-08 16:31:12 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-04-15 09:07:17 +0000 |
commit | 551e79f4beeca71855ea7b505db27d0e7111cddd (patch) | |
tree | 524780ec3d0f580bd8910439afcc3d53e3d8972b | |
parent | df260c0893543af28fa32d687d558a4190578eed (diff) |
Fix observation canceling in the simplecoapclient example
Changed th lambda for canceling the resource observation to capture
variables by value instead of capturing by reference. If we capture
'url' by reference, it will be already destroyed, when the lambda is
called.
Fixes: QTBUG-75156
Change-Id: I76792555d4eff8391b0a5075d45cd48b9e3bb918
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | examples/simplecoapclient/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/simplecoapclient/mainwindow.cpp b/examples/simplecoapclient/mainwindow.cpp index 937b9cf..c14f3ce 100644 --- a/examples/simplecoapclient/mainwindow.cpp +++ b/examples/simplecoapclient/mainwindow.cpp @@ -215,7 +215,7 @@ void MainWindow::on_observeButton_clicked() connect(observeReply, &QCoapReply::notified, this, &MainWindow::onNotified); ui->cancelObserveButton->setEnabled(true); - connect(ui->cancelObserveButton, &QPushButton::clicked, this, [&]() { + connect(ui->cancelObserveButton, &QPushButton::clicked, this, [=]() { m_client->cancelObserve(url); ui->cancelObserveButton->setEnabled(false); }); |