Android 15 (at least) seems to have changed how float arguments are passed to native functions, breaking our (conceptually correct) code for processing the va_arg list into a list of static argument types of the function implementation. To fix this, we have to move away from using a va_arg function, and register a function with statically typed arguments instead. Use a template function that we instantiate with variadic arguments deduced from the actual function, using a factory-helper that generates a JNINativeMethod struct with that template instantiation as the function pointer. Move all of that into a struct where we can also declare the signature string as compile-time constant without cluttering the namespace with static objects. We can now remove the helpers that took care of type promotion in va_arg functions, and of the tuple-construction from a va_list. As a drive-by, don't cast function pointers to void *; it's strictly speaking undefined behavior in C and should have generated a compiler warning, if not a hard error [1]. We must initialize the JNINativeMethod::fnPtr member with the address of the function pointer instead. [1] https://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p8 Also, declare the native method as the JNICALL calling convention. That is only defined on Windows, so makes no difference in practice, but it's the correct thing to do anyway. Fixes: QTBUG-132410 Change-Id: I190b95fcbcd07cf99c6765fa426c3c351f91994a Reviewed-by: Volker Krause <vkrause@kde.org> (cherry picked from commit e91a17873ee4ae58d369b8eb70029cf895b31d03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 103aa5afb2d95f883daea41715c97455550285b2) |
||
|---|---|---|
| .. | ||
| animation | ||
| global | ||
| io | ||
| ipc | ||
| itemmodels | ||
| kernel | ||
| mimetypes | ||
| platform | ||
| plugin | ||
| serialization | ||
| text | ||
| thread | ||
| time | ||
| tools | ||
| CMakeLists.txt | ||