summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cppuhelper/source/shlib.cxx72
1 files changed, 41 insertions, 31 deletions
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 8ad77f516190..ecb3f1fb4bff 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -188,47 +188,57 @@ Reference< XInterface > invokeComponentFactory(
fprintf(stderr, "invokeComponentFactory envDcp:%s implName:%s modPath:%s\n", envDcp.getStr(), implName.getStr(), modPath.getStr());
}
#endif
-
- Mapping aCurrent2Env( currentEnv, env );
- Mapping aEnv2Current( env, currentEnv );
-
- if (aCurrent2Env.is() && aEnv2Current.is())
+ if (env.get() == currentEnv.get())
{
- void * pSMgr = aCurrent2Env.mapInterface(
- xMgr.get(), ::getCppuType( &xMgr ) );
+ xRet.set(
+ static_cast<css::uno::XInterface *>(
+ (*reinterpret_cast<component_getFactoryFunc>(pGetter))(
+ aImplName.getStr(), xMgr.get(), 0)),
+ SAL_NO_ACQUIRE);
+ }
+ else
+ {
+ Mapping aCurrent2Env( currentEnv, env );
+ Mapping aEnv2Current( env, currentEnv );
- void * pSSF = NULL;
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xMgr.get(), ::getCppuType( &xMgr ) );
- env.invoke(s_getFactory, pGetter, &aImplName, pSMgr, 0, &pSSF);
+ void * pSSF = NULL;
- if (pSMgr)
- {
- (*env.get()->pExtEnv->releaseInterface)(
- env.get()->pExtEnv, pSMgr );
- }
+ env.invoke(s_getFactory, pGetter, &aImplName, pSMgr, 0, &pSSF);
- if (pSSF)
- {
- aEnv2Current.mapInterface(
- reinterpret_cast< void ** >( &xRet ),
- pSSF, ::getCppuType( &xRet ) );
- (env.get()->pExtEnv->releaseInterface)(
- env.get()->pExtEnv, pSSF );
+ if (pSMgr)
+ {
+ (*env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pSMgr );
+ }
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( &xRet ) );
+ (env.get()->pExtEnv->releaseInterface)(
+ env.get()->pExtEnv, pSSF );
+ }
+ else
+ {
+ rExcMsg = rModulePath +
+ ": cannot get factory of " +
+ "demanded implementation: " +
+ OStringToOUString(
+ aImplName, RTL_TEXTENCODING_ASCII_US );
+ }
}
else
{
- rExcMsg = rModulePath +
- ": cannot get factory of " +
- "demanded implementation: " +
- OStringToOUString(
- aImplName, RTL_TEXTENCODING_ASCII_US );
+ rExcMsg =
+ "cannot get uno mappings: C++ <=> UNO!";
}
}
- else
- {
- rExcMsg =
- "cannot get uno mappings: C++ <=> UNO!";
- }
}
else
{