Capture the pointer to info by value
authorKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 17 Jun 2020 10:29:14 +0000 (12:29 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 30 Jun 2020 09:29:08 +0000 (11:29 +0200)
Using a reference capture is a disaster waiting to happen here, if for
some reason we'd move from exec() to popup() for the menu below we'd be
getting garbage in the lambda call.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/accountsettings.cpp

index 8b0a36c6f278c292cfe9ce11f3dff526485d5021..20b02a15bb919d74f9cd3ca751cd393ce3e4417e 100644 (file)
@@ -559,7 +559,7 @@ void AccountSettings::slotSubfolderContextMenuRequested(const QModelIndex& index
 
         if (!isEncrypted) {
             ac = menu.addAction(tr("Encrypt"));
-            connect(ac, &QAction::triggered, [this, &info] { slotMarkSubfolderEncrypted(info); });
+            connect(ac, &QAction::triggered, [this, info] { slotMarkSubfolderEncrypted(info); });
         } else {
             // Ingore decrypting for now since it only works with an empty folder
             // connect(ac, &QAction::triggered, [this, &info] { slotMarkSubfolderDecrypted(info); });