Hi Thomas,

thomas.deweese wrote:
> 
>    I think the only way the following stack trace can
> occur is if you setSVGDocument with the currently displayed
> SVGDocument.   
> 

Thanks a lot but, this is not the case. Actually, I am first calling
setDocument(null) to free the memory used by the SVG and then after some
time, when the SVG is needed again I am again loadIng the file, parsing and
putting a new fresh Document to the canvas.

But I debugged a bit more and I think I found the problem (but still no
solution or workaround).

I found in the sources of AbstractJGVTComponent.renderGVTTree() that the
event dispatcher is disabled before the rendering...
        // Disable the dispatch during the rendering
        // to avoid concurrent access to the GVT tree.
        if (eventDispatcher != null) {
            eventDispatcher.setEventDispatchEnabled(false);
        }
... and then turned on again when the rendering is finished.

But in my handler for GVT Build Completed I am calling
setRenderingTransform:
        public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
                svgCanvas.setRenderingTransform(transform, true);
        }
This causes the current rendering to stop and a new one to start. The
AbstractJGVTComponent$Listener.renderingStopped() method is called, where:
... a new rendering is scheduled:
                renderGVTTree();
... and the event dispatcher is enabled again:
                eventDispatcher.setEventDispatchEnabled(true);

So it might be that the event dispatcher gets enabled in the middle of the
new rendering.
Do you think this is possible?

You might wonder why I am calling setRenderingTransform for the newly loaded
SVG. This is because I am loading again the same SVG and I'd like to keep
the zoom / pan / rotation so the user sees the SVG exactly in the same way
like before it was unloaded (by setDocument(null)). Is there a better way to
set the transform for a newly loaded SVG? I'd like to avoid showing first
the whole graphics and then zoom & pan etc.

Thanks!
Lukasz

-- 
View this message in context: 
http://www.nabble.com/Threading-problem-when-using-JSVGCanvas.setSVGDocument-tp20147098p20149809.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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

Reply via email to