summaryrefslogtreecommitdiff
path: root/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx')
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 21de11b5ea36..9ba5af012443 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -16,6 +16,11 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+
+#include <sal/config.h>
+
+#include <typeinfo>
+
#include <com/sun/star/uno/RuntimeException.hpp>
#include <sal/log.hxx>
#include <uno/data.h>
@@ -457,7 +462,7 @@ namespace
}
}
-struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
+struct bridges::cpp_uno::shared::VtableFactory::Slot { void const * fn; };
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
@@ -471,6 +476,12 @@ std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
return (slotCount + 2) * sizeof (Slot);
}
+namespace {
+// Some dummy type whose RTTI is used in the synthesized proxy vtables to make uses of dynamic_cast
+// on such proxy objects not crash:
+struct ProxyRtti {};
+}
+
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
void * block, sal_Int32 slotCount, sal_Int32,
@@ -478,7 +489,7 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock(
{
Slot * slots = mapBlockToVtable(block);
slots[-2].fn = 0;
- slots[-1].fn = 0;
+ slots[-1].fn = &typeid(ProxyRtti);
return slots + slotCount;
}