Lukasz Matuszczak wrote:

I am not sure what is a proper way to close JSVGCanvas, and all its inner objects and threads. Do I have to use "stopProcessing" method or is calling of "dispose" method sufficient?.

Dispose should be enough (it will call stopProcessing if something is going on).

I want to free all image caches too. Does method flushImageCache() from JSVGComponent fulfil my needs or do I need to call flush() from JGVTComponent?

'flushImageCache' is different from 'flush' on the JGVTComponent. I should have dispose call flush() (thanks for bringing this to my attention).

   The Image cache uses SoftReferences so they will clear as soon as
there is memory pressure.

   Calling 'flush' will clear cached rendered tiles for static
documents (there shouldn't be anything for dynamic documents).
This is a combined soft/hard reference cache (limited to ~4MB).

I am also curious if it is safe to call above mentioned methods before my JSVGCanvas is fully started (ie before gvtBuildCompleted, gvtRenderingCompleted methods are called).

Yes it should be.

I think that is important because i occassionally ran into an exception (in 1.5.1 release):
java.lang.NullPointerException at org.apache.batik.swing.svg.JSVGComponent.stopThenRun(JSVGComponent.java:606)

I think you can only get this if you call 'dispose' out of the swing thread.

I think that the whole JSVGCanvas lifecycle is a bit complicated.

Well, any multi-threaded object's lifecycle tends to be a bit complex.

I haven't found any detailed description of it,

What sort of description would be useful? Can you point me to an example of what you would be interested in?

so it is not obvious for me which methods may be called asynchronously on JSVGCanvas and when they may be called.

_NO_ method may be called asynchronously on JSVGCanvas. Like all swing components you can only safely interact with them in the swing event thread.

I have also a short question about listeners related to JSVGCanvas object.Is it true that all methods in listeners registered on JSVGCanvas events (for example in GVTTreeRendererListeners) are invoked from AWT event dispatching thread? I discovered it recently and I am not sure if it is an intentional behaviour.

Yes, it is intentional it should only call listeners registered on it from the Swing thread.


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



Reply via email to