properly ask Qt to create qml opengl surface with proper options
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 9 Mar 2022 10:44:51 +0000 (11:44 +0100)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Thu, 10 Mar 2022 14:19:46 +0000 (14:19 +0000)
should prevent context losses error with some opengl drivers

should prevent corruptions to occur with come opengl drivers

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/main.cpp

index bf78b4c076db251ca567936601326672cb433f4f..be74c4447f6218393bfbb1d679f11501f94f8698 100644 (file)
@@ -93,6 +93,11 @@ int main(int argc, char **argv)
 #ifdef Q_OS_MAC
     Mac::CocoaInitializer cocoaInit; // RIIA
 #endif
+
+    auto surfaceFormat = QSurfaceFormat::defaultFormat();
+    surfaceFormat.setOption(QSurfaceFormat::ResetNotification);
+    QSurfaceFormat::setDefaultFormat(surfaceFormat);
+
     OCC::Application app(argc, argv);
 
 #ifdef Q_OS_WIN
@@ -126,10 +131,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    auto surfaceFormat = QSurfaceFormat::defaultFormat();
-    surfaceFormat.setOption(QSurfaceFormat::ResetNotification);
-    QSurfaceFormat::setDefaultFormat(surfaceFormat);
-
 // check a environment variable for core dumps
 #ifdef Q_OS_UNIX
     if (!qEnvironmentVariableIsEmpty("OWNCLOUD_CORE_DUMP")) {