diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-10-26 18:33:33 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-10-27 17:44:35 +0200 |
| commit | 8c9f5fba0343433bca8285df1a80bb3a606ca2ef (patch) | |
| tree | d55b8b8883ce57e05bd20a5d9383baa3149da833 /src/plugins/platforms/android/qandroidplatformintegration.cpp | |
| parent | 703614f03b73fbcc63d8315bb6a2a86156476341 (diff) | |
Android: don't rely on implicit cast of declared QtJniTypes to jobject
The operator jobject() should be removed from declared QtJniTypes in
qtbase, as it's dangerous. Prepare for that by calling object(), which
returns the wrapped jobject as well, or isValid() where previously the
implicit conversion to jobject also enabled implicit conversion to bool.
Change-Id: I00cf6f1463dd5ab5cbaf03d9e77bfff3bced9b15
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformintegration.cpp')
| -rw-r--r-- | src/plugins/platforms/android/qandroidplatformintegration.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index cc3711b7463..84ab311a11e 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -320,11 +320,11 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const switch (cap) { case ApplicationState: return true; case ThreadedPixmaps: return true; - case NativeWidgets: return QtAndroidPrivate::activity(); - case OpenGL: return QtAndroidPrivate::activity(); - case ForeignWindows: return QtAndroidPrivate::activity(); - case ThreadedOpenGL: return !needsBasicRenderloopWorkaround() && QtAndroidPrivate::activity(); - case RasterGLSurface: return QtAndroidPrivate::activity(); + case NativeWidgets: return QtAndroidPrivate::activity().isValid(); + case OpenGL: return QtAndroidPrivate::activity().isValid(); + case ForeignWindows: return QtAndroidPrivate::activity().isValid(); + case ThreadedOpenGL: return !needsBasicRenderloopWorkaround() && QtAndroidPrivate::activity().isValid(); + case RasterGLSurface: return QtAndroidPrivate::activity().isValid(); case TopStackedNativeChildWindows: return false; case MaximizeUsingFullscreenGeometry: return true; default: @@ -334,7 +334,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const QPlatformBackingStore *QAndroidPlatformIntegration::createPlatformBackingStore(QWindow *window) const { - if (!QtAndroidPrivate::activity()) + if (!QtAndroidPrivate::activity().isValid()) return nullptr; return new QAndroidPlatformBackingStore(window); @@ -342,7 +342,7 @@ QPlatformBackingStore *QAndroidPlatformIntegration::createPlatformBackingStore(Q QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - if (!QtAndroidPrivate::activity()) + if (!QtAndroidPrivate::activity().isValid()) return nullptr; QSurfaceFormat format(context->format()); format.setAlphaBufferSize(8); @@ -360,7 +360,7 @@ QOpenGLContext *QAndroidPlatformIntegration::createOpenGLContext(EGLContext cont QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const { - if (!QtAndroidPrivate::activity()) + if (!QtAndroidPrivate::activity().isValid()) return nullptr; QSurfaceFormat format(surface->requestedFormat()); @@ -374,7 +374,7 @@ QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenS QOffscreenSurface *QAndroidPlatformIntegration::createOffscreenSurface(ANativeWindow *nativeSurface) const { - if (!QtAndroidPrivate::activity() || !nativeSurface) + if (!QtAndroidPrivate::activity().isValid() || !nativeSurface) return nullptr; auto *surface = new QOffscreenSurface; @@ -385,7 +385,7 @@ QOffscreenSurface *QAndroidPlatformIntegration::createOffscreenSurface(ANativeWi QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const { - if (!QtAndroidPrivate::activity()) + if (!QtAndroidPrivate::activity().isValid()) return nullptr; #if QT_CONFIG(vulkan) |
