| View previous topic :: View next topic |
| Author |
Message |
danilabagroff General User

Joined: 08 Feb 2008 Posts: 13
|
Posted: Fri Feb 27, 2009 6:53 am Post subject: C++. Disconnect from OO. |
|
|
Hello all
I'll tried to find correctly solution, but...
I make a TCP connection to the OO and after processing my document I want to properly close this connection. How can I do this?
| Code: |
Reference <XComponentContext> x_component_context(::cppu::bootstrap());
_x_multi_component_factory_client = Reference <XMultiComponentFactory> (x_component_context->getServiceManager());
_x_interface = Reference <XInterface>(_x_multi_component_factory_client->createInstanceWithContext(OUString::createFromAscii("com.sun.star.bridge.UnoUrlResolver" ), x_component_context));
Reference <XUnoUrlResolver> resolver(_x_interface, UNO_QUERY);
_x_interface = Reference <XInterface> (resolver->resolve(connection_string), UNO_QUERY);
Reference <XPropertySet> x_prop_set(_x_interface, UNO_QUERY);
x_prop_set->getPropertyValue(OUString::createFromAscii("DefaultContext")) >>= x_component_context;
Reference <XMultiComponentFactory> x_multi_component_factory_server(x_component_context->getServiceManager());
_x_component_loader = Reference <XComponentLoader>(x_multi_component_factory_server->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), x_component_context), UNO_QUERY);
|
* I tried to use dispose(), but running instance of OO was crashed. |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
danilabagroff General User

Joined: 08 Feb 2008 Posts: 13
|
Posted: Sun Mar 01, 2009 2:39 pm Post subject: |
|
|
I tried do the same with c++
| Code: |
Reference <XComponentContext> x_component_context(::cppu::bootstrap());
Reference <XConnector> x_connector(x_component_context->getServiceManager()->createInstanceWithContext(OUString::createFromAscii("com.sun.star.connection.Connector"), x_component_context), UNO_QUERY);
Reference <XConnection> x_connection = x_connector->connect(connection_string);
Reference <XBridgeFactory> x_bridge_factory(x_component_context->getServiceManager()->createInstanceWithContext(OUString::createFromAscii("com.sun.star.bridge.BridgeFactory"), x_component_context), UNO_QUERY);
_x_bridge = x_bridge_factory->createBridge(OUString::createFromAscii(""), OUString::createFromAscii("urp"), x_connection, Reference <XInstanceProvider> ());
Reference <XComponent> x_component(_x_bridge, UNO_QUERY);
Reference <XMultiComponentFactory> x_multi_component_factory(_x_bridge->getInstance(OUString::createFromAscii("StarOffice.ServiceManager")), UNO_QUERY);
Reference <XPropertySet> x_propery_set(x_multi_component_factory, UNO_QUERY);
x_propery_set->getPropertyValue(OUString::createFromAscii("DefaultContext")) >>= x_component_context;
Reference <XMultiComponentFactory> x_multi_component_factory_server(x_component_context->getServiceManager());
_x_component_loader = Reference <XComponentLoader>(x_multi_component_factory_server->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), x_component_context), UNO_QUERY);
|
I have segfault on: x_bridge_factory->createBridge
with:
0xb7f2ed20 in com::sun::star::uno::Reference<com::sun::star::bridge::XBridge>::set (this=0x804c31c, pInterface=0x80900dc)
at /usr/lib/openoffice/sdk/include/com/sun/star/uno/Reference.hxx:242
242 pOld->release();
Will be greate, if somebody have any ideas. |
|
| Back to top |
|
 |
danilabagroff General User

Joined: 08 Feb 2008 Posts: 13
|
Posted: Mon Mar 02, 2009 2:29 am Post subject: |
|
|
Solved.
| Code: |
Reference <XComponentContext> x_component_context(::cppu::bootstrap());
Reference <XConnector> x_connector(x_component_context->getServiceManager()->createInstanceWithContext(OUString::createFromAscii("com.sun.star.connection.Connector"), x_component_context), UNO_QUERY);
Reference <XConnection> x_connection = x_connector->connect(connection_string);
Reference <XBridgeFactory> x_bridge_factory(x_component_context->getServiceManager()->createInstanceWithContext(OUString::createFromAscii("com.sun.star.bridge.BridgeFactory"), x_component_context), UNO_QUERY);
_x_bridge = x_bridge_factory->createBridge(OUString(), OUString::createFromAscii("urp"), x_connection, 0);
Reference <XComponent> x_component(_x_bridge, UNO_QUERY);
Reference <XMultiComponentFactory> x_multi_component_factory(_x_bridge->getInstance(OUString::createFromAscii("StarOffice.ServiceManager")), UNO_QUERY);
Reference <XPropertySet> x_propery_set(x_multi_component_factory, UNO_QUERY);
x_propery_set->getPropertyValue(OUString::createFromAscii("DefaultContext")) >>= x_component_context;
Reference <XMultiComponentFactory> x_multi_component_factory_server(x_component_context->getServiceManager());
_x_component_loader = Reference <XComponentLoader>(x_multi_component_factory_server->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), x_component_context), UNO_QUERY);
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|