Hi,

the oood gets to know, that an office is not used, when there are no
object references mapped anymore. In your case, there still seem to be
objects mapped, though from the source code, it shouldn't be the case.
I'll played around a little bit with your example, but I need to debug it at some time in future.

But even if in this the interprocess connection would correctly interrupt and free the worker office, it is quite 'fragile' solution as a single leaking object reference will break your app.

I do not really know, what you try to achieve,

* When you need an office sequentially, simple use a single office once got from the demon. * When you need to access multiple offices concurrently, try to pool the office in your client (connect only once and always use these office instances) * Alternativel,yau can explicitly dispose uno bridges, but you have to create interprocess bridges somewhat more complicated (to get to know the bridge, that is used), see

http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+3+1+4+Opening+a+Connection

and

http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.htm#1+3+1+7+Example%3A+A+Connection+Aware+Client

for an example. The Bridge object also export an XComponent, which cannot disposed.

However, this solution has one drawback. In case, one of the central office objects (e.g. component context, servicemanager, etc.), you cannot use them once you coincidentally reconnect to the same worker (You will get then URP-Bridge: disposed runtime exceptions).

Hope this helps a bit (but I probably brought in more confusion than explanation ? ). BTW, this issue is the reason, why I mentioned in demon's document in the very beginning, that there might be problems with server clients.

Bye,

Joerg


Laurent Godard wrote:
> Hi all,
>
> I'm using oood and experience some problem on leaving an instance. The
> instance remains marked as 'in use' even when the pyUNO calling script
> is ended. Trying to dispose the context ctx crashes OOo
> Has someone experienced some problems with oood regarding freeing
> instances ?
>
> here is attached an example. oood is launched with one single instance.
> The first pass in the loop is ok, then on the second, an error occurs
>
> any hint or advice  are welcommed
>
> thanks in advance
>
> Laurent
> '--------------
>
> import uno
> import time
> from com.sun.star.beans import PropertyValue
>
> # Python Imports
>
> import os
> import sys
>
> def main():
>     fini=False
>     while not fini:
>         context = uno.getComponentContext()
>         tmp = context.ServiceManager
>         while not tmp:
>             time.sleep(2)
>             context = uno.getComponentContext()
>             tmp = context.ServiceManager
>         resolver = context.ServiceManager.createInstanceWithContext(
>             "com.sun.star.bridge.UnoUrlResolver", context)
>         try:
>             ctx =
> resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
>
>         except:
>             print "Could not connect to running openoffice."
>             sys.exit()
>         if ctx :
>            fini= True
>         else:
>             print "ctx == None"
>             time.sleep(2)
>     desktop =
> ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",ctx)
>
>     ctx.ServiceManager
>     context.ServiceManager
>
> if __name__=="__main__":
>     print sys.version
>     for i in range(1,5):
>         print "test nb %s"%i
>         main()
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to