OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Problem with adding & removing event listeners.

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
James Miles
General User
General User


Joined: 28 Nov 2005
Posts: 22
Location: Perth - Australia

PostPosted: Mon Dec 05, 2005 1:16 am    Post subject: Problem with adding & removing event listeners. Reply with quote

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
View user's profile Send private message Send e-mail
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Mon Dec 05, 2005 10:20 am    Post subject: Reply with quote

Perhaps add an other event listener to watch OOo ending.
Hope there is beter to do.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Mon Dec 05, 2005 10:51 am    Post subject: Already tried Reply with quote

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
View user's profile Send private message Visit poster's website
James Miles
General User
General User


Joined: 28 Nov 2005
Posts: 22
Location: Perth - Australia

PostPosted: Mon Dec 05, 2005 8:01 pm    Post subject: Some more testing. Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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