Ver Fonte

Make some lambda captures explicit

I feel like this is safer. Semantics/generated code should be the same.
Vincent Lang há 7 anos atrás
pai
commit
adf4bdc67b
2 ficheiros alterados com 7 adições e 7 exclusões
  1. 3 3
      src/system/UpdaterComponent.cpp
  2. 4 4
      src/ui/KonvergoWindow.cpp

+ 3 - 3
src/system/UpdaterComponent.cpp

@@ -41,7 +41,7 @@ UpdaterComponent::UpdaterComponent(QObject* parent) :
 
   connect(&m_netManager, &QNetworkAccessManager::finished, this, &UpdaterComponent::dlComplete);
 
-  connect(&SystemComponent::Get(), &SystemComponent::userInfoChanged, [&](){
+  connect(&SystemComponent::Get(), &SystemComponent::userInfoChanged, [this](){
     if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "automaticUpdates").toBool())
       QTimer::singleShot(10 * 1000, this, &UpdaterComponent::checkForUpdate);
   });
@@ -87,11 +87,11 @@ void UpdaterComponent::checkForUpdate()
     QNetworkRequest req(baseUrl);
     req.setPriority(QNetworkRequest::HighPriority);
     m_checkReply = m_netManager.get(req);
-    connect(m_checkReply, &QNetworkReply::readyRead, [&]()
+    connect(m_checkReply, &QNetworkReply::readyRead, [this]()
     {
       m_checkData.append(m_checkReply->read(m_checkReply->bytesAvailable()));
     });
-    connect(m_checkReply, &QNetworkReply::finished, [&]()
+    connect(m_checkReply, &QNetworkReply::finished, [this]()
     {
       auto updateData = parseUpdateData(m_checkData);
       if (!updateData.isEmpty())

+ 4 - 4
src/ui/KonvergoWindow.cpp

@@ -408,7 +408,7 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
 
       if (oldDesktopMode != newDesktopMode)
       {
-        QTimer::singleShot(0, [=]
+        QTimer::singleShot(0, [this, newDesktopMode]
         {
           PlayerComponent::Get().stop();
           m_webDesktopMode = newDesktopMode;
@@ -560,11 +560,11 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 #ifdef Q_OS_MAC
   if (visibility == QWindow::Windowed)
   {
-    QTimer::singleShot(1 * 1000, [&] { OSXUtils::SetPresentationOptions(m_osxPresentationOptions); });
+    QTimer::singleShot(1 * 1000, [this] { OSXUtils::SetPresentationOptions(m_osxPresentationOptions); });
   }
   else if (visibility == QWindow::FullScreen)
   {
-    QTimer::singleShot(1 * 1000, [&] {
+    QTimer::singleShot(1 * 1000, [this] {
       OSXUtils::SetPresentationOptions(m_osxPresentationOptions | OSXUtils::GetPresentationOptionsForFullscreen(!m_webDesktopMode));
     });
   }
@@ -832,7 +832,7 @@ void KonvergoWindow::onScreenAdded(QScreen *screen)
 {
   updateScreens();
   // The timer is out of fear for chaotic mid-change states.
-  QTimer::singleShot(200, [=]
+  QTimer::singleShot(200, [this]
   {
     updateForcedScreen();
   });