04658a7067
When a JS function implementing a UNO interface method returns any or a sequence type (like queryInterface, getType, and getImplementationId in uno.js), it could not create a new instance of that type and return it, as it would have needed to call .delete() on that instance, but couldn't. In uno.js, getType and getImplementationId solved that by returning pre-instantiated instances that were deleted in the final release call. But that did not work for queryInterface, as pre-instantiating the relevant any instances would have caused cyclic references that would have caused the final release call never to occur. So redesign the C++ the_wrapper classes (used by the Embind allow_subclass machinery): If a UNO interface method returns any or a sequence type (i.e., a type on which .delete() must be called), change the JS implemenation's return type from by-value (which meant that the C++ code received a copy) to by-reference---which means that now the C++ code can access the original instance and delete it. But which also means that the JS code must always return a fresh instance now! (Ideally, the embindmaker-generated code would use by-pointer rather than by-reference for that return type, but that caused > emsdk/upstream/emscripten/cache/sysroot/include/emscripten/wire.h:116:19: error: static assertion failed due to requirement '!std::is_pointer<com::sun:⭐:uno::Any *>::value': Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>> > 116 | static_assert(!std::is_pointer<T*>::value, "Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>>"); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ errors with no obvious place where to put such allow_raw_pointer markers, so lets go with this little hack at least for now.) Change-Id: I3c37b79b8fbf09c19782c6532bc95d4d63505c63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169008 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> |
||
---|---|---|
.. | ||
source | ||
IwyuFilter_unotest.yaml | ||
Jar_test-tools.mk | ||
Jar_test.mk | ||
Library_embindtest.mk | ||
Library_unobootstrapprotector.mk | ||
Library_unoexceptionprotector.mk | ||
Library_unotest.mk | ||
Makefile | ||
Module_unotest.mk | ||
README.md |
Tests for UNO
Contains tests for UNO