Hi Lukasz, [EMAIL PROTECTED] wrote on 10/24/2008 05:26:37 AM:
> I discovered a threading problem in JSVGCanvas. When I load a new > SVG document into an existing canvas showing an SVG and move the > mouse over it during the rendering, then often I get an exception. > It can be an IllegalArgumentException, an > ArrayIndexOutOfBoundsException, a StringIndexOutOfBoundsException or > a NullPointerException, but it always occurs somewhere in the text > processing (see stack traces below). It looks like the mouse event > handling thread interferes with the rendering thread. > > The problem does not occur if I use JSVGCanvas.loadSVGDocument > instead of setSVGDocument. > > Is there a solution for that? I think the only way the following stack trace can occur is if you setSVGDocument with the currently displayed SVGDocument. What is happening is that when you set the document to the canvas it starts creating a new graphics tree but when you move the mouse over the canvas it tries to do 'hit detection' on the graphics tree while it is in flux and bad things happen. loadSVGDocument creates a new copy of the document so it doesn't have this problem (one copy is being displayed while the new copy is having it's graphics tree built). So the real question is why you would set the same Document Object to the canvas? Most places where people do that would be better served by telling the Canvas the document should be treated as dynamic and making sure the changes you want to display are made in the UpdateManager's RunnableQueue. > Thread [AWT-EventQueue-0] (Suspended (exception > IllegalArgumentException)) > AttributedString.addAttributes(Map<Attribute,?>, int, int) > line: not available > BidiAttributedCharacterIterator.
