Fix warning
authorHannah von Reth <hannah.vonreth@owncloud.com>
Tue, 14 Jul 2020 10:49:18 +0000 (12:49 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:15 +0000 (10:59 +0100)
warning C4573: the usage of 'QObject::disconnect' requires the compiler to capture 'this' but the current default capture mode does not allow it

src/gui/application.cpp

index b44c37fdccbb47019fcba840560684d720dcfaea..d9272a69d990f5cb21e49f8de98ce1f2a148718d 100644 (file)
@@ -801,8 +801,8 @@ void Application::openVirtualFile(const QString &filename)
     folder->implicitlyHydrateFile(relativePath);
     QString normalName = filename.left(filename.size() - virtualFileExt.size());
     auto con = QSharedPointer<QMetaObject::Connection>::create();
-    *con = QObject::connect(folder, &Folder::syncFinished, [con, normalName] {
-        QObject::disconnect(*con);
+    *con = connect(folder, &Folder::syncFinished, folder, [folder, con, normalName] {
+        folder->disconnect(*con);
         if (QFile::exists(normalName)) {
             QDesktopServices::openUrl(QUrl::fromLocalFile(normalName));
         }