| View previous topic :: View next topic |
| Author |
Message |
James Miles General User

Joined: 28 Nov 2005 Posts: 22 Location: Perth - Australia
|
Posted: Mon Dec 05, 2005 1:16 am Post subject: Problem with adding & removing event listeners. |
|
|
Hi Guys,
I have been using C# to write a "wrapper" for open office. I'm registering some listeners when i connect to open office using the following code;
| Code: |
// Get the OpenOffice desktop object.
XDesktop remoteDesktop = remoteFactory.createInstance("com.sun.star.frame.Desktop") as XDesktop;
// Register the local terminate listener with the remote desktop.
_terminateListener.OnTerminate += new OpenOffice.TerminateListener.Terminate(_terminateListener_OnTerminate);
remoteDesktop.addTerminateListener( this._terminateListener ); |
I'm also removing this listener when my connection object is disposed.
| Code: | public void Dispose()
{
_desktop.removeTerminateListener( _terminateListener );
} |
This works fine until i kill my client process abnormally. IE go into task manager and kill it, meaning the dispose code, removeTerminateListener is never called.
The next time i try to connect and add the listener, the following exception is thrown by the server;
| Quote: | An unhandled exception of type 'unoidl.com.sun.star.lang.DisposedException' occurred in mscorlib.dll
Additional information: URP-Bridge: disposed(tid=2096) Unexpected connection closure |
No matter what extent the client goes to, there will always be situations where this happens. For example if i'm connecting to OpenOffice via a network channel that drops out, there is no way to call removeTerminateListener.This continues to happen until soffice.bin is shutdown & restarted.
Have i done something silly? Or is this a serious problem?
Cheers,
James Miles. |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
LarsB OOo Advocate


Joined: 31 Aug 2005 Posts: 445 Location: Hamburg, Germany
|
Posted: Mon Dec 05, 2005 10:51 am Post subject: Already tried |
|
|
Hi Serge,
James already tried that. It's still the same problem.
I'm also a little bit confused why this happens!?
Cheers
LarsB _________________ AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In
http://www.OpenDocument4all.com/ |
|
| Back to top |
|
 |
James Miles General User

Joined: 28 Nov 2005 Posts: 22 Location: Perth - Australia
|
Posted: Mon Dec 05, 2005 8:01 pm Post subject: Some more testing. |
|
|
Hi Guys,
I've actually done some more testing, and the addEventListener on the XFrame seems to work fine.
The XDesktop does not have an addEventListener method though.
Cheers,
James. |
|
| Back to top |
|
 |
|